BIFIEdata
BIFIE.data.Rd
This function creates an object of class BIFIEdata
.
Finite sampling correction of statistical inferences can be
conducted by specifying appropriate input in the fayfac
argument.
List of multiply imputed datasets. Can be also a list of list of imputed
datasets in case of nested multiple imputation. Then, the argument
NMI=TRUE
must be specified.
A string indicating the label of case weight or a vector containing all case weights.
Optional vector of replicate weights
Fay factor for calculating standard errors, a numeric value. If finite sampling correction is requested, an appropriate vector input can be used (see Example 3).
Optional vector for names of plausible values, see
BIFIE.data.jack
.
Optional vector for prefixes of plausible values, see
BIFIE.data.jack
.
An optional logical indicating whether the BIFIEdata
object should be compactly saved. The default is FALSE
.
Optional logical indicating whether data.list
is obtained
by nested multiple imputation.
Object of class BIFIEdata
Object of class BIFIEdata
Further arguments to be passed
An object of class BIFIEdata
saved in a non-compact
or compact way, see value cdata
. The following entries are
included in the list:
Stacked list of imputed datasets (if cdata=FALSE
)
Vector with case weights
Matrix with replicate weights
Number of imputed datasets
Number of observations in a dataset
Last imputed dataset
Vector with variable names
Fay factor.
Number of replicate weights
Logical indicating whether the dataset is nested multiply imputed.
Logical indicating whether the BIFIEdata
object is in
compact format (cdata=TRUE
) or in a non-compact format
(cdata=FALSE
).
Number of variables
Data frame including some informations about variables.
All transformations are saved in the column source
.
Data frame with response indicators
(if cdata=TRUE
)
Data frame with imputed values
(if cdata=TRUE
)
See BIFIE.data.transform
for data transformations on
BIFIEdata
objects.
For saving and loading BIFIEdata
objects see
save.BIFIEdata
.
For converting PIRLS/TIMSS or PISA datasets into BIFIEdata
objects see BIFIE.data.jack
.
See the BIFIEdata2svrepdesign
function for converting
BIFIEdata
objects to objects used in the survey package.
#############################################################################
# EXAMPLE 1: Create BIFIEdata object with multiply-imputed TIMSS data
#############################################################################
data(data.timss1)
data(data.timssrep)
bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
wgtrep=data.timssrep[, -1 ] )
summary(bdat)
# create BIFIEdata object in a compact way
bdat2 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
wgtrep=data.timssrep[, -1 ], cdata=TRUE)
summary(bdat2)
if (FALSE) {
#############################################################################
# EXAMPLE 2: Create BIFIEdata object with one dataset
#############################################################################
data(data.timss2)
# use first dataset with missing data from data.timss2
bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss2[[1]], wgt=data.timss2[[1]]$TOTWGT)
}
#############################################################################
# EXAMPLE 3: BIFIEdata objects with finite sampling correction
#############################################################################
data(data.timss1)
data(data.timssrep)
#-----
# BIFIEdata object without finite sampling correction
bdat1 <- BIFIEsurvey::BIFIE.data( data.list=data.timss1, wgt=data.timss1[[1]]$TOTWGT,
wgtrep=data.timssrep[, -1 ] )
summary(bdat1)
#-----
# generate BIFIEdata object with finite sampling correction by adjusting
# the "fayfac" factor
bdat2 <- bdat1
#-- modify "fayfac" constant
fayfac0 <- bdat1$fayfac
# set fayfac=.75 for the first 50 replication zones (25% of students in the
# population were sampled) and fayfac=.20 for replication zones 51-75
# (meaning that 80% of students were sampled)
fayfac <- rep( fayfac0, bdat1$RR )
fayfac[1:50] <- fayfac0 * .75
fayfac[51:75] <- fayfac0 * .20
# include this modified "fayfac" factor in bdat2
bdat2$fayfac <- fayfac
summary(bdat2)
summary(bdat1)
#---- compare some univariate statistics
# no finite sampling correction
res1 <- BIFIEsurvey::BIFIE.univar( bdat1, vars="ASMMAT")
summary(res1)
# finite sampling correction
res2 <- BIFIEsurvey::BIFIE.univar( bdat2, vars="ASMMAT")
summary(res2)
if (FALSE) {
#############################################################################
# EXAMPLE 4: Create BIFIEdata object with nested multiply imputed dataset
#############################################################################
data(data.timss4)
data(data.timssrep)
# nested imputed dataset, save it in compact format
bdat <- BIFIEsurvey::BIFIE.data( data.list=data.timss4,
wgt=data.timss4[[1]][[1]]$TOTWGT, wgtrep=data.timssrep[, -1 ],
NMI=TRUE, cdata=TRUE )
summary(bdat)
}