[R] Mitools and lmer
Thomas Lumley
tlumley at u.washington.edu
Mon Mar 5 16:51:16 CET 2007
Doug,
It's mitools, not mltools. I wrote it.
I think the problem is just that coef() is not the right function for
getting the fixed effects. Beth wants
betas <- MIextract(model0, fun=fixef)
-thomas
On Sat, 3 Mar 2007, Douglas Bates wrote:
> On 3/2/07, Beth Gifford <beth.gifford at duke.edu> wrote:
>> Hey there
>> I am estimating a multilevel model using lmer. I have 5 imputed datasets so
>> I am using mitools to pool the estimates from the 5
>> datasets. Everything seems to work until I try to use
>> MIcombine to produced pooled estimates. Does anyone have any suggestions? The betas and the standard errors were extracted with no problem so everything seems to work smoothly up until that point.
>
> I'm not familiar with the mltools package and I didn't see it listed
> in the CRAN packages. Can you provide a reference or a link to the
> package?
>
>>> Program
>>> #Read data
>>> data.dir<-system.file("dta",package="mitools")
>>> files.imp<-imputationList(lapply(list.files(data.dir,
>>> pattern="imp.\\.dta", full=TRUE), read.dta))
>>>
>>> #estimate model over each imputed dataset
>>> model0<-with(files.imp,lmer( erq2tnc ~1+trt2+nash+wash+male+coh2+coh3+(1 |
>>> sitebeth)))
>>> #extract betas and standard errors
>>> betas<-MIextract(model0,fun=coef)
>>> vars<-MIextract(model0,fun=vcov)
>>> #Combine the results
>>> summary(MIcombine(betas,vars))
>
>>> Error in cbar + results[[i]] : non-numeric argument to binary operator
>>> Error in summary(MIcombine(betas, vars)) :
>>> error in evaluating the argument 'object' in selecting a method for
>>> function 'summary'
>
> First use traceback() to discover where the (first) error occurred.
> My guess is that Mlcombine expects a particular type of object for the
> vars argument and it is not getting that type (and not checking for
> the correct type).
>
>>
>>
>>
>> Thanks
>> Beth
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help
mailing list