BIFIE.data {BIFIEsurvey}R Documentation

Creates an Object of Class BIFIEdata

Description

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.

Usage

BIFIE.data(data.list, wgt=NULL, wgtrep=NULL, fayfac=1, pv_vars=NULL,
     pvpre=NULL, cdata=FALSE, NMI=FALSE)

## S3 method for class 'BIFIEdata'
summary(object,...)

## S3 method for class 'BIFIEdata'
print(x,...)

Arguments

data.list

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.

wgt

A string indicating the label of case weight or a vector containing all case weights.

wgtrep

Optional vector of replicate weights

fayfac

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).

pv_vars

Optional vector for names of plausible values, see BIFIE.data.jack.

pvpre

Optional vector for prefixes of plausible values, see BIFIE.data.jack.

cdata

An optional logical indicating whether the BIFIEdata object should be compactly saved. The default is FALSE.

NMI

Optional logical indicating whether data.list is obtained by nested multiple imputation.

object

Object of class BIFIEdata

x

Object of class BIFIEdata

...

Further arguments to be passed

Value

An object of class BIFIEdata saved in a non-compact or compact way, see value cdata. The following entries are included in the list:

datalistM

Stacked list of imputed datasets (if cdata=FALSE)

wgt

Vector with case weights

wgtrep

Matrix with replicate weights

Nimp

Number of imputed datasets

N

Number of observations in a dataset

dat1

Last imputed dataset

varnames

Vector with variable names

fayfac

Fay factor.

RR

Number of replicate weights

NMI

Logical indicating whether the dataset is nested multiply imputed.

cdata

Logical indicating whether the BIFIEdata object is in compact format (cdata=TRUE) or in a non-compact format (cdata=FALSE).

Nvars

Number of variables

variables

Data frame including some informations about variables. All transformations are saved in the column source.

datalistM_ind

Data frame with response indicators (if cdata=TRUE)

datalistM_imputed

Data frame with imputed values (if cdata=TRUE)

See Also

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.

Examples

#############################################################################
# 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)

## Not run: 
#############################################################################
# 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)

## End(Not run)

#############################################################################
# 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)

## Not run: 
#############################################################################
# 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)

## End(Not run)

[Package BIFIEsurvey version 3.3-12 Index]