Frank E Harrell Jr
2004-Aug-14 14:10 UTC
[R] Re: extracting datasets from aregImpute objects
From: <david_foreman at doctors.org.uk> Subject: [R] Re: extracting datasets from aregImpute objects To: <r-help at stat.math.ethz.ch> Message-ID: <1092391719_117440 at drn10msi01> Content-Type: text/plain; charset="us-ascii" I've tried doing this by specifying x=TRUE, which provides me with a single imputation, that has been useful. However, the help file possibly suggests that I should get a flat-file matrix of n.impute imputations, presumably with indexing. I'm a bit stuck using alternatives to aregImpute, as neither MICE nor Amelia seem to like my dataset, and Frank Harrell no longer recommends Transcan for multiple imputations. ----- David, aregImpute produces a list containing the multiple imputations: w <- aregImpute(. . .) w$imputed$blood.pressure # gets m by k matrix # m = number of subjects with blood pressure missing, # k = number of multiple imputations To get a completed dataset (but for only one draw of the k multiple imputations) see how fit.mult.impute does it. I have just added the following example to the help file for aregImpute. set.seed(23) x <- runif(200) y <- x + runif(200, -.05, .05) y[1:20] <- NA d <- data.frame(x,y) f <- aregImpute(~ x + y, n.impute=10, match='closest', data=d) # Here is how to create a completed dataset for imputation # number 3 as fit.mult.impute would do automatically. In this # degenerate case changing 3 to 1-2,4-10 will not alter the results. completed <- d imputed <- impute.transcan(f, imputation=3, data=d, list.out=TRUE, pr=FALSE, check=FALSE) completed[names(imputed)] <- imputed completed # 200 by 2 data frame -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Maybe Matching Threads
- Re: extracting datasets from aregImpute objects
- aregImpute: beginner's question
- Confused about multiple imputation with rms or Hmisc packages
- Hmisc multiple imputation functions
- Re: Thanks Frank, setting graph parameters, and why social scientists don't use R