Hi everyone, Does anyone here has experience using MICE to impute missing value? I am having problem to pool the imputed dataset for a MANOVA test, could you give me some advice please? Here is my code: > library(mice) > grd3dat=subset(paper2,Control==1&Grade_1==3,select=c(Boy,BVCategoryT1,reclassify,meanseap_1,meandep_1,meananx_1,meanper_1,meanrelma_1,meandiff_1,meanascon_1,meanclasc_1,meanschoc_1)) > grd3imp=mice(grd3dat,m=20,seed=123,print=F) > grd3mod=with(grd3imp,lm(cbind(meanseap_1,meandep_1,meananx_1)~Boy*BVCategoryT1)) > summary(pool(grd3mod)) Error in table[, 8] <- x$nmis[names(x$qbar)] : replacement has length zero > pool(grd3mod) Call: pool(object = grd3mod) Pooled coefficients: [1] 2.51538922 0.08041626 -0.02266421 0.33964482 -0.38691307 -0.28778570 -0.10405965 0.12206124 0.86739342 -0.17195284 0.04784570 -0.38342776 [13] -0.07785758 0.27914375 0.09205530 -0.09185746 2.04934495 -0.34833583 -0.02972867 -0.65564544 -0.33033151 0.29788500 0.11309193 0.32081963 Fraction of information about the coefficients missing due to nonresponse: [1] 0.2113750 0.2137368 0.3849378 0.1885110 0.2056638 0.4089043 0.1960244 0.1116587 0.2015711 0.1960397 0.3745362 0.2108851 0.2545268 0.4241958 0.2146440 [16] 0.2520252 0.2380274 0.2131245 0.3006583 0.2464491 0.2915607 0.2173454 0.1970864 0.1422042 Thank you very much. YA
HI Nicole, Homework? No, it is a part of analysis for my paper. Any idea? ya At 2012-03-30 23:32:21,"Nicole Marie Ford" <nmford@uwm.edu> wrote:>ya, > >is this homework? > > >----- Original Message ----- >From: "ya" <xinxi813@163.com> >To: r-help@r-project.org >Sent: Friday, March 30, 2012 9:04:59 AM >Subject: [R] pooling in MICE > >Hi everyone, > >Does anyone here has experience using MICE to impute missing value? I am >having problem to pool the imputed dataset for a MANOVA test, could you >give me some advice please? >Here is my code: > > library(mice) > > >grd3dat=subset(paper2,Control==1&Grade_1==3,select=c(Boy,BVCategoryT1,reclassify,meanseap_1,meandep_1,meananx_1,meanper_1,meanrelma_1,meandiff_1,meanascon_1,meanclasc_1,meanschoc_1)) > > grd3imp=mice(grd3dat,m=20,seed=123,print=F) > > grd3mod=with(grd3imp,lm(cbind(meanseap_1,meandep_1,meananx_1)~Boy*BVCategoryT1)) > > summary(pool(grd3mod)) >Error in table[, 8] <- x$nmis[names(x$qbar)] : > replacement has length zero > > > pool(grd3mod) >Call: pool(object = grd3mod) >Pooled coefficients: > [1] 2.51538922 0.08041626 -0.02266421 0.33964482 -0.38691307 -0.28778570 -0.10405965 0.12206124 0.86739342 -0.17195284 0.04784570 -0.38342776 >[13] -0.07785758 0.27914375 0.09205530 -0.09185746 2.04934495 -0.34833583 -0.02972867 -0.65564544 -0.33033151 0.29788500 0.11309193 0.32081963 >Fraction of information about the coefficients missing due to nonresponse: > [1] 0.2113750 0.2137368 0.3849378 0.1885110 0.2056638 0.4089043 0.1960244 0.1116587 0.2015711 0.1960397 0.3745362 0.2108851 0.2545268 0.4241958 0.2146440 >[16] 0.2520252 0.2380274 0.2131245 0.3006583 0.2464491 0.2915607 0.2173454 0.1970864 0.1422042 >Thank you very much. > >YA > >______________________________________________ >R-help@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
Hi Nicole, Thank you very much for the code. I agree with you that the code in the pdf could work just fine. However, maybe my situation is a little bit different, since I "cbind" three dependent variables. I think this may cause some problems when pooling. I can not use MANOVA function because it gave me a warning that no vcov() method can be found. ya At 2012-03-31 03:15:29,"Nicole Marie Ford" <nmford@uwm.edu> wrote:>this is for a different discipline... > >but the code may work... > > >http://www.quantoid.net/l11_miceR.pdf > >if not let me know. > >----- Original Message ----- >From: "123" <xinxi813@163.com> >To: "Nicole Marie Ford" <nmford@uwm.edu>, "r-help" <r-help@r-project.org> >Sent: Friday, March 30, 2012 10:46:12 AM >Subject: Re:Re: [R] pooling in MICE > > > > >HI Nicole, > >Homework? No, it is a part of analysis for my paper. Any idea? > >ya > > > > > >At 2012-03-30 23:32:21,"Nicole Marie Ford" <nmford@uwm.edu> wrote: >>ya, >> >>is this homework? >> >> >>----- Original Message ----- >>From: "ya" <xinxi813@163.com> >>To: r-help@r-project.org >>Sent: Friday, March 30, 2012 9:04:59 AM >>Subject: [R] pooling in MICE >> >>Hi everyone, >> >>Does anyone here has experience using MICE to impute missing value? I am >>having problem to pool the imputed dataset for a MANOVA test, could you >>give me some advice please? >>Here is my code: >> > library(mice) >> > >>grd3dat=subset(paper2,Control==1&Grade_1==3,select=c(Boy,BVCategoryT1,reclassify,meanseap_1,meandep_1,meananx_1,meanper_1,meanrelma_1,meandiff_1,meanascon_1,meanclasc_1,meanschoc_1)) >> > grd3imp=mice(grd3dat,m=20,seed=123,print=F) >> > grd3mod=with(grd3imp,lm(cbind(meanseap_1,meandep_1,meananx_1)~Boy*BVCategoryT1)) >> > summary(pool(grd3mod)) >>Error in table[, 8] <- x$nmis[names(x$qbar)] : >> replacement has length zero >> >> > pool(grd3mod) >>Call: pool(object = grd3mod) >>Pooled coefficients: >> [1] 2.51538922 0.08041626 -0.02266421 0.33964482 -0.38691307 -0.28778570 -0.10405965 0.12206124 0.86739342 -0.17195284 0.04784570 -0.38342776 >>[13] -0.07785758 0.27914375 0.09205530 -0.09185746 2.04934495 -0.34833583 -0.02972867 -0.65564544 -0.33033151 0.29788500 0.11309193 0.32081963 >>Fraction of information about the coefficients missing due to nonresponse: >> [1] 0.2113750 0.2137368 0.3849378 0.1885110 0.2056638 0.4089043 0.1960244 0.1116587 0.2015711 0.1960397 0.3745362 0.2108851 0.2545268 0.4241958 0.2146440 >>[16] 0.2520252 0.2380274 0.2131245 0.3006583 0.2464491 0.2915607 0.2173454 0.1970864 0.1422042 >>Thank you very much. >> >>YA >> >>______________________________________________ >>R-help@r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
Hi Nicole, Thank you very much for helping. I also got feedback from one of the authors of MICE package: "The problem you encounter with manova() is that it has no vcov() method. The vcov() function is used in the pool() function to calculate the within and between imputation variance. If you are dealing with longitudinal data you may use lme() instead of manova(). The lme() function does have a vcov() function. Otherwise you should pool the separate ANOVA tables that you obtained from the manova() function from each imputed datasets by hand. But it is not very straightforward how to do this. " I have been trying the lme() with only one time point, have not succeeded. Is it possible to have only one time point for lme()? I think lm() should work. Assuming I am not doing a MANOVA, but multivariate multiple regression, the code then is actually same, right? What is the error suppose to mean? I googled, not so many results about it. > grd3mod=with(grd3imp,lm(cbind(meanseap_1,meandep_1,meananx_1)~Boy*BVCategoryT1)) > summary(pool(grd3mod)) Error in table[, 8] <- x$nmis[names(x$qbar)] : replacement has length zero At last, if all these can not work, then I guess manually pooling the separate ANOVA tables from manova() function is the only way, do you know how to do this? Any example? Thank you very much for all these help. Best regards, YA At 2012-04-01 21:34:59,"Nicole Marie Ford" <nmford@uwm.edu> wrote:>HI YA, > >i have only pooled missing data for multivariate models... which is almost exclusively what i use. > >i was hoping that code might be able to be altered in some way for you. > >i tried messing with it given your information but i was not successful... > >i am sorry! > >~nicole > >----- Original Message ----- >From: "ya" <xinxi813@163.com> >To: r-help@r-project.org >Sent: Friday, March 30, 2012 9:04:59 AM >Subject: [R] pooling in MICE > >Hi everyone, > >Does anyone here has experience using MICE to impute missing value? I am >having problem to pool the imputed dataset for a MANOVA test, could you >give me some advice please? >Here is my code: > > library(mice) > > >grd3dat=subset(paper2,Control==1&Grade_1==3,select=c(Boy,BVCategoryT1,reclassify,meanseap_1,meandep_1,meananx_1,meanper_1,meanrelma_1,meandiff_1,meanascon_1,meanclasc_1,meanschoc_1)) > > grd3imp=mice(grd3dat,m=20,seed=123,print=F) > > grd3mod=with(grd3imp,lm(cbind(meanseap_1,meandep_1,meananx_1)~Boy*BVCategoryT1)) > > summary(pool(grd3mod)) >Error in table[, 8] <- x$nmis[names(x$qbar)] : > replacement has length zero > > > pool(grd3mod) >Call: pool(object = grd3mod) >Pooled coefficients: > [1] 2.51538922 0.08041626 -0.02266421 0.33964482 -0.38691307 -0.28778570 -0.10405965 0.12206124 0.86739342 -0.17195284 0.04784570 -0.38342776 >[13] -0.07785758 0.27914375 0.09205530 -0.09185746 2.04934495 -0.34833583 -0.02972867 -0.65564544 -0.33033151 0.29788500 0.11309193 0.32081963 >Fraction of information about the coefficients missing due to nonresponse: > [1] 0.2113750 0.2137368 0.3849378 0.1885110 0.2056638 0.4089043 0.1960244 0.1116587 0.2015711 0.1960397 0.3745362 0.2108851 0.2545268 0.4241958 0.2146440 >[16] 0.2520252 0.2380274 0.2131245 0.3006583 0.2464491 0.2915607 0.2173454 0.1970864 0.1422042 >Thank you very much. > >YA > >______________________________________________ >R-help@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]