mice.impute.2l.latentgroupmean.ml | R Documentation |
The imputation method 2l.latentgroupmean
imputes a latent group mean
assuming an infinite population of subjects within a group
(Grund, Luedtke & Robitzsch, 2018; see also
Luedtke, Marsh, Robitzsch, Trautwein, Asparouhov & Muthen, 2008
or Croon & van Veldhoven, 2007).
Therefore, unreliability of group means when treating subjects as
indicators is taken into account.
The imputation method mice.impute.2l.groupmean
just imputes (i.e. computes)
the manifest group mean. See also
mice::mice.impute.2lonly.mean
.
The imputation method mice.impute.2l.groupmean.elim
computes the
group mean eliminating the subject under study from the calculation.
Therefore, this imputation method will lead to different values of
individuals within the same group.
mice.impute.2l.latentgroupmean.ml(y, ry, x, type, pls.facs=NULL,
imputationWeights=NULL, interactions=NULL, quadratics=NULL,
EAP=FALSE, ...)
mice.impute.2l.latentgroupmean.mcmc(y, ry, x, type, pls.facs=NULL,
imputationWeights=NULL, interactions=NULL, quadratics=NULL,
mcmc.burnin=100, mcmc.adapt=100, mcmc.iter=1000, draw.fixed=TRUE, EAP=FALSE, ...)
mice.impute.2l.groupmean(y, ry, x, type, grmeanwarning=TRUE, ...)
mice.impute.2l.groupmean.elim(y, ry, x, type, ...)
y |
Incomplete data vector of length |
ry |
Vector of missing data pattern ( |
x |
Matrix ( |
type |
Type of predictor variables. |
pls.facs |
Number of factors used for PLS regression (optional). |
imputationWeights |
Optional vector of sample weights. |
interactions |
Vector of variable names used for creating interactions |
quadratics |
Vector of variable names used for creating quadratic terms |
draw.fixed |
Optional logical indicating whether parameters for fixed effects should be sampled. |
EAP |
Logical indicating whether EAPs should be used for imputation.
The default |
mcmc.burnin |
Number of MCMC burn-in iterations. |
mcmc.adapt |
Number of MCMC iterations in adaptation phase. |
mcmc.iter |
Total number of MCMC iterations. |
grmeanwarning |
An optional logical indicating whether some group means cannot be calculated. |
... |
Further arguments to be passed. |
The imputation of the latent group mean uses the
lme4::lmer
function of the lme4 package
for mice.impute.2l.latentgroupmean.ml
and the
MCMCglmm::MCMCglmm
function
of the MCMCglmm package for mice.impute.2l.latentgroupmean.ml
.
Latent group mean imputation also follows
Mislevy (1991).
A vector of length y
containing imputed group means.
Croon, M. A., & van Veldhoven, M. J. (2007). Predicting group-level outcome variables from variables measured at the individual level: a latent variable multilevel model. Psychological Methods, 12(1), 45-57. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/1082-989X.12.1.45")}
Grund, S., Luedtke, O., & Robitzsch, A. (2018). Multiple imputation of missing data at level 2: A comparison of fully conditional and joint modeling in multilevel designs. Journal of Educational and Behavioral Statistics, 43(3), 316-353. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3102/1076998617738087")}
Luedtke, O., Marsh, H. W., Robitzsch, A., Trautwein, U., Asparouhov, T., & Muthen, B. (2008). The multilevel latent covariate model: a new, more reliable approach to group-level effects in contextual studies. Psychological Methods, 13(3), 203-229. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/a0012869")}
Mislevy, R. J. (1991). Randomization-based inference about latent variables from complex samples. Psychometrika, 56(2), 177-196. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02294457")}
mice::mice.impute.2lonly.mean
## Not run:
#############################################################################
# EXAMPLE 1: Two-level imputation data.ma05 dataset with imputation
# of a latent group mean
#############################################################################
data(data.ma05)
dat <- data.ma05
# include manifest group mean for 'Mscore'
dat$M.Mscore <- NA
# include latent group group for 'Mscore'
dat$LM.Mscore <- NA #=> LM: latent group mean
# define predictor matrix
predM <- mice::make.predictorMatrix(data=dat)
# exclude student ISs
predM[, "idstud"] <- 0
# idclass is the cluster identifier
predM[, "idclass" ] <- -2
# define imputation methods
impMethod <- mice::make.method(data=dat)
# initialize with norm
impMethod <- rep( "norm", length(impMethod) )
names(impMethod) <- names( imp$method )
impMethod[ c("idstud","idclass")] <- ""
#*****
# STUDENT LEVEL (Level 1)
# Use a random slope model for Dscore and Mscore as the imputation method.
# Here, variance homogeneity of residuals is assumed (contrary to
# the 2l.norm imputation method in the mice package).
impMethod[ c("Dscore", "Mscore") ] <- "2l.pan"
predM[ c("Dscore","Mscore"), "misei" ] <- 2 # random slopes on 'misei'
predM[, "idclass" ] <- -2
# For imputing 'manote' and 'denote' use contextual effects (i.e. cluster means)
# of variables 'misei' and 'migrant'
impMethod[ c("denote", "manote") ] <- "2l.contextual.pmm"
predM[ c("denote", "manote"), c("misei","migrant")] <- 2
# Use no cluster variable 'idclass' for imputation of 'misei'
impMethod[ "misei"] <- "norm"
predM[ "misei", "idclass"] <- 0 # use no multilevel imputation model
# Variable migrant: contextual effects of Dscore and misei
impMethod[ "migrant"] <- "2l.contextual.pmm"
predM[ "migrant", c("Dscore", "misei" ) ] <- 2
predM[ "migrant", "idclass" ] <- -2
#****
# CLASS LEVEL (Level 2)
# impute 'sprengel' and 'groesse' at the level of classes
impMethod[ "sprengel"] <- "2lonly.pmm2"
impMethod[ "groesse"] <- "2lonly.norm2"
predM[ c("sprengel","groesse"), "idclass" ] <- -2
# manifest group mean for Mscore
impMethod[ "M.Mscore" ] <- "2l.groupmean"
# latent group mean for Mscore
impMethod[ "LM.Mscore" ] <- "2l.latentgroupmean.ml"
predM[ "M.Mscore", "Mscore" ] <- 2
# covariates for latent group mean of 'Mscore'
predM[ "LM.Mscore", "Mscore" ] <- 2
predM[ "LM.Mscore", c( "Dscore", "sprengel" ) ] <- 1
# do imputations
imp <- mice::mice( dat, predictorMatrix=predM, m=3, maxit=4,
method=impMethod, allow.na=TRUE, pan.iter=100)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.