I'm stumbling my way through manipulating data in multiply imputed datasets,
and have run into a problem translating code I used to run on my pre-imputed
dataset to multiple datasets. The imputation runs just fine, as does the
reading of the mi data sets into an imputationList. I run into trouble,
though, when I try to construct a scale across all the data sets. Is there
a simple way to do this?
(here's what I've been trying)
vars_to_impute = c("var1", ... "var50")
imputed <- amelia(data=vars_to_impute, m=5, outname="miset")
files.allmisets <- list.files(getwd(),pattern="miset*",full=TRUE)
allmis <- imputationList(lapply(files.allmisets, read.csv))
scale1_vars <- c("var1", "var2", "var3", ...
"var20")
scale2_vars <- c("var21", "var22", "var23", ...
"var34")
allmis <- update(allmis, myscale1 = rowMeans(allmis[scale1_vars],
na.rm=TRUE))
allmis <- update(allmis, myscale2 = rowMeans(allmis[scale2_vars],
na.rm=TRUE))
Any help with this or general pointers about how to manage scale
construction across multiple data sets much appreciated.
Don
[[alternative HTML version deleted]]