Dear list, Is there any one use MICE package deal with multilevel missing values here? I have a question about the 2lonly.pmm() and 2lonly.norm(), I get the following error quite often. Here is the code the error, could you give me some advice please? Am I using it in the right way?
> ini=mice(bhrm,maxit=0) > pred=ini$pred > pred V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 V2 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 V3 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 V4 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 V5 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 V6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V14 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 V15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 V16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 V18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > for(i in 1:5)pred[i,]=c(rep(0,5),rep(2,8),0,0,-2,1,2) > imp=mice(bhrm,meth=c(rep("2l.norm",5),rep("",8),rep("2lonly.norm",2),"","",""),pred=pred,maxit=10,print=F) Error in .imputation.level2(y = y, ry = ry, x = x, type = type, imputationMethod = "norm", : define for 2lonly imputation one and only grouping variable with type=-2 > imp=mice(bhrm,meth=c(rep("2l.norm",5),rep("",8),rep("2lonly.pmm",2),"","",""),pred=pred,maxit=10,print=F) Error in .imputation.level2(y = y, ry = ry, x = x, type = type, imputationMethod = "pmm", : define for 2lonly imputation one and only grouping variable with type=-2 In this code, V1-V5 are first level variables with missing values, v6-v13 are first level random variables without any missing values, v14-v15 are second level variables with missing values, v16 is the grouping variable, v17 is the fixed effect without any missing values, v18 is the intercept. There are 30 groups with at least 1 response in the target variable for each group, and more than 1000 cases. The data were mainly from the "bhr2000" data set in the multilevel package. I made the two second level data myself, the value of them ranges from 1 to 3. My purpose was to impute the v1-v5 and v14-v15. I can succeed in imputing the v1-v5 if v14 and v15 were not in the model, but I could not impute the missing values in v14 and v15. Thank you very much. Best regards, ya [[alternative HTML version deleted]] ______________________________________________ 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.