Dear list,
I am trying to impute the missing values for the first level variables in a two
level data set using MICE package. Here is my code and error I got:
> aa=mice(a,maxit=0)
> aaa=aa$pred
> aaa
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
V1 0 0 0 0 0 0 0 0 0 0
V2 0 0 0 0 0 0 0 0 0 0
V3 0 0 0 0 0 0 0 0 0 0
V4 1 1 1 0 1 1 1 1 1 1
V5 1 1 1 1 0 1 1 1 1 1
V6 1 1 1 1 1 0 1 1 1 1
V7 1 1 1 1 1 1 0 1 1 1
V8 1 1 1 1 1 1 1 0 1 1
V9 1 1 1 1 1 1 1 1 0 1
V10 0 0 0 0 0 0 0 0 0 0> aaa["V4",]=c(2,2,2,0,0,0,0,0,0,-2)
>
aaaa=mice(a,meth=c("","","","2l.norm","","","","","",""))
iter imp variable
1 1 V4Error in factor(x[, type == (-2)], labels = 1:n.class) :
invalid labels; length 2 should be 1 or 0
The class variable is –2. Random effects 2, and fixed effects 1, not in the
model: 0. Can anyone give me some advice please?
Thank you very much.
Best regards,
ya
[[alternative HTML version deleted]]