[R-sig-ME] Problem with bootMer and models with offset

Martin Hecht martin.hecht at iqb.hu-berlin.de
Tue Oct 14 11:03:20 CEST 2014


Am 14.10.2014 10:30, schrieb Martin Hecht:
> Am 14.10.2014 04:16, schrieb Ben Bolker:
>> Martin Hecht <martin.hecht at ...> writes:
>>
>>> Hi,
>>>
>>> I am using the latest version of R (3.1.1) and lme4 (1.1-7) .
>>>
>>> I'm getting some weird implausible bootstrap results from bootMer for a
>>> model with an offset (models without offset work fine).
>>>
>>> I've attached an Rdata file with the returned object from lmer (lmerObj)
>>> and the returned object from bootMer (booted)
>>   Unfortunately, Rdata/RData files get stripped by the mailing list
>> software (there's a short list of attachments that get allowed --
>> I'm not sure how to find it -- probably includes txt and CSV files
>> but not much else).
> the data can be downloaded (for the next 28 days) here:
> https://www3.hu-berlin.de/dateiaustausch?g=n2sqg2kpexkgv7n2n9uz
>>> Any help would be appreciated very much.
>>>
>>> the syntax is:
>>>
>>> booted <- bootMer ( x = lmerObj , FUN =
>>> function(fit){return(c(fixef(fit),getME(fit,'theta')))} , nsim = 100 ,
>>> seed = 65835 , verbose = TRUE )
>>>
>>>> booted$t0[1]
>>> (Intercept)
>>>     2.606621
>>>
>>>> mean(booted$t[,1])
>>> [1] -78.21035
>>>
>>>> boot::boot.ci ( booted , conf = 0.95 , type = "basic" , index = 1 )
>>> BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
>>> Based on 100 bootstrap replicates
>>>
>>> CALL :
>>> boot::boot.ci(boot.out = booted, conf = 0.95, type = "basic",
>>>     index = 1)
>>>
>>> Intervals :
>>> Level      Basic        
>>> 95%   (69.864, 95.425 ) 
>>> Calculations and Intervals on Original Scale
>>> Some basic intervals may be unstable
>>   This does indeed seem weird.
>>
>>   Does plot(booted,1) help at all?
> the plot looks not that suspicious, except for the strange mean
>>   I wonder if a workaround for now is to add the offset manually;
>> that should be perfectly feasible (if not quite as convenient)
>> for a linear mixed model -- it's only really *necessary* for
>> a GLMM ...
> adding the offset (43.8) manually won't work
I have now added the mean of the offset variable "Nitems.fixed" (81.7)
to the bootstrap values of the Intercept
booted2 <- booted
booted2$t[,1] <- booted2$t[,1] + mean(d2$Nitems.fixed)

this actually comes quite close the original model estimate of the
Intercept (and will probably converge with more runs)
booted2$t0[1]
(Intercept)
   2.606621

mean(booted2$t[,1])
  3.476917

still, now I am wondering how to manually correct the other fixed
effects (predictors)

for instance predictor "NAFmcC" has a model estimate of
booted2$t0[3]
   NAFmcC
  -24.41153

the mean from the bootstrap is
mean(booted2$t[,3])
  -67.93461

How can this be done?

>
> thanks for your help!
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>


-- 
Dipl.-Psych. Martin Hecht

Institut zur Qualitätsentwicklung im Bildungswesen
Humboldt-Universität zu Berlin
Dienstsitz: Luisenstraße 56
Postanschrift: Unter den Linden 6, 10099 Berlin

Tel: +49-(0)30 2093-46589
Fax: +49-(0)30 2093-5336
Email: martin.hecht at iqb.hu-berlin.de
www: http://www.iqb.hu-berlin.de



More information about the R-sig-mixed-models mailing list