I am having problems with the MICE package in R, particularity with pooling the 
imputed data sets.
I am running a multilevel binomial logistic regression, with Level1 - topic 
(participant response to 10 questions on different topics, e.g. T_Darkness, 
T_Day) nested within Level2 - individuals. 
The model is created using R2MLwiN, the formula is 
> fit1 <-runMLwiN( c(probit(T_Darkness, cons), probit(T_Day, cons), 
> probit(T_Light, cons), probit(T_Night, cons), probit(T_Rain, cons), 
> probit(T_Rainbows, cons), probit(T_Snow, cons), probit(T_Storms, cons), 
> probit(T_Waterfalls, cons), probit(T_Waves, cons)) ~ 1, D=c("Mixed", 
> "Binomial", "Binomial","Binomial","Binomial", "Binomial", "Binomial", 
> "Binomial", "Binomial", "Binomial" ,"Binomial"), estoptions = list(EstM = 0), 
> data=data)Unfortunately, there is missing data in all of the Level1 (topic) 
> responses. I have been using the mice package ([CRAN][1]) to multiply impute 
> the missing values. 
I can fit the model to the imputed datasets, using the formula 
> fitMI <- (with(MI.Data, runMLwiN( c(probit(T_Darkness, cons), probit(T_Day, 
> cons), probit(T_Light, cons), probit(T_Night, cons), probit(T_Rain, cons), 
> probit(T_Rainbows, cons), probit(T_Snow, cons), probit(T_Storms, cons), 
> probit(T_Waterfalls, cons), probit(T_Waves, cons)) ~ 1, D=c("Mixed", 
> "Binomial", "Binomial","Binomial","Binomial", "Binomial", "Binomial", 
> "Binomial", "Binomial", "Binomial" ,"Binomial"), estoptions = list(EstM = 0), 
> data=data)))
 However, when I come to pool the analyses with the call code > pool(fitMI) it 
fails, with the Error:Error in pool(with(tempData, 
runMLwiN(c(probit(T_Darkness, cons), probit(T_Day, : Object has no coef() 
method.
I am not sure why it is saying there is no coefficient, as the analyses of the 
individual MI datasets provide both fixed parts (coefficients) and random parts 
(covariances)
Any help with what is going wrong would be much appreciated. I should warn you 
that this is my first foray into using R and multilevel modelling. Also I know 
there is a MlwiN package ([REALCOM][2]) that can do this but I don't have the 
background to use the MLwiN software outside of R.
thanks
johnny

 R reproducible example
Libraries used
 > library(R2MLwiN) > library(mice)
Subset of data`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0, 0, 0, NA, 1, 0, 0, 0, 1, 0, 0, NA, 0, 
> 1, 0, 0, 0, 0, 0, 1, 1, NA, 1, 1, NA, 0, 0, 0, NA, 0, 0, 0, NA, 0, 0) 
> data <- data.frame (T_Darkness, T_Day, T_Light, T_Night, T_Rain, T_Rainbows, 
> T_Snow, T_Storms, T_Waterfalls, T_Waves) 
> data$cons <- 1

Data imputed using mice with
 > MI.Data <- mice(data,m=5,maxit=50,meth='pmm',seed=500)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to