[R] analzying multiple variables (dv) in a sequence by using fit.mult.impute together with a MICE.object

Leo Gürtler leog at anicca-vijja.de
Mon Nov 28 14:24:48 CET 2005


Dear list members,

my problem is to analyze multiple variables by using a simple loop.
Without a loop, no problem:

fit1 <- fit.mult.impute(variable_from_MIC_datset ~ group, fitter=ols, 
xtrans=imp.dmat)

Without a multiple imputation data set, that works:

vars <- c(
"lverb.ona", "l2", "lalles.ona", "vl", "notdmer.ona", "pisalern.ona", 
"lern",
"pswa", "pswn", "pska", "pskd", "pskt", "pkoo", "pkom", "isall", "vorwisse",
"im", "ke", "sb", "an", "akog", "aemo", "amb", "stru")

for(i in vars)
{  lm(dmat[,i]~ group)  }

However, I do not know how to specifiy the following correctly with the 
MICE object:

for(i in vars)
{
  fit1 <- fit.mult.impute(?????? ~ group, fitter=ols, xtrans=imp.dmat)
}

Looking into the structure of MICE objects, each of the x multiple 
imputed datasets is stored in a data.frame within a list. That list is 
named after the respective variable.
If I specify just the variable like

imp.dmat$imp$var_name

that does not work, because it is just the name of the list element. 
Otherwise by specifying one of the columns with the list element, the 
multiple datasets would be missed.
I thought about using eval() or expr() but without real succes.

Every hint is appreciated,

best regards

leo gürtler




More information about the R-help mailing list