Greg Blevins
2003-Jul-25 11:28 UTC
[R] Difficulty replacing NAs using Hmisc aregImpute and Impute
Hello R experts I am using Hmisc aregImpute and Impute (following example on page 105 of The Hmisc and Design Libraries). *My end goal is to have NAs physically replaced in my dataframe. I have read the help pages and example in above sited pdf file, but to no avail. Here is example of what I did. Ph, my data frame, is attached.> xt <- aregImpute (~ q5 + q22rev02 + q28a, n.impute=10, x=T, data=Ph)Iteration:1 2 3 4 5 6 7 8 9 10 11 12 13> impute(xt)Multiple Imputation using Bootstrap and PMM aregImpute(formula = ~q5 + q22rev02 + q28a, data = Ph, n.impute = 10, x = T) Method: ace n= 406 p= 3 Imputations: 10 Number of NAs: q5 q22rev02 q28a 0 88 51 R-squares for Predicting Non-Missing Values for Each Variable Using Last Imputations of Predictors q22rev02 q28a 0.348 0.170> mean(q28a)[1] NA The q28a that the system is looking at still has NAs. Much appreciate any help! Greg Blevins The Market Solutions Group, Inc.
Jonathan Baron
2003-Jul-25 12:22 UTC
[R] Difficulty replacing NAs using Hmisc aregImpute and Impute
On 07/25/03 06:28, Greg Blevins wrote:>Hello R experts >*My end goal is to have NAs physically replaced in my dataframe. I have >read the help pages and example in above sited pdf file, but to no avail.aregImpute does not do what you want. It creates n.impute different values for each missing datum. You san see them with "imputed" in what it returns. You might be able to get what you want with some other package such as EMV, mix, norm, or the impute function in Hmisc. An excellent and discussion of imputation for the novice (which I just read yesterday - being a novice myself!) is by Shafer and Graham, in Psychological Methods, 2002, 7, 147-177. What aregImput does is shown in Fig. 4 of that paper, as I understand it. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/