[R-sig-ME] bootMer: 2 questions about generating standard errors in lme4
Ben Bolker
bbolker at gmail.com
Fri Aug 15 23:34:32 CEST 2014
On Fri, Aug 15, 2014 at 8:48 AM, Jeffrey Evans <jeff at jeffreyevans.org>
wrote:
> Hi all,
>
> I am trying to generate standard errors for the predicted values from a
> binomial GLMM in lme4. There have been a number of posts about using
> bootMer to accomplish this, but the obtuse language in the help file
If you'd like to give specific suggestions that would help improve the help
file that would be great ...
> and in these posts continues to befuddle me, and the responses often seem
> tailored to specific cases (e.g. https://stat.ethz.ch/
> pipermail/r-sig-mixed-models/2013q3/020663.html). My questions are:
>
> (1) Could someone please help tailor a response for my specific case?
> (2) Can bootMer be run in parallel on a multi-core windows machine? I
> found some code fragments on the web from Ben Bolker that appear to attempt
> this using snow, but it doesn't seem to be implemented in the current
> version of lme4. http://ms.mcmaster.ca/~bolker/misc/bootMer_min.Rout
>
>
It should, I think (I could be wrong, I haven't tried it lately or looked
back at the code). Did you try? "doesn't seem to be implemented" -- do
you get an error message? What error message?
> My model has one fixed categorical effect (site), and random effects for
> the experimental unit (ID) and year (Year):
>
> m1 = glmer(cbind(S,F) ~ site + (1|ID) + (1|Year),
> data=dat,family="binomial")
>
> where S and F are the numbers of successes and failures, respectively and
> year is coded as a factor.
>
> I want marginal predictions for each site, which I can generate with the
> predict function, but how do I get standard errors for those predictions
> which incorporate variance due to year?
>
> # generate marginal predictions
> pred = predict(m1,newdata=data.frame(site=unique(dat$site)),REform=
> NA,type="response")
>
Minor point: re.form is preferred to REform , we're hoping to deprecate
REform in the future.
> # are these options correct?
> predSE = bootMer(m1, predict, use.u=T,type="parametric",nsim =
> 10,.progress="txt")
>
You'll have to think about it carefully for yourself, but I think it
would be better *not* to condition on the estimated conditional modes for
ID and Year; I would use
nd <- data.frame(site=unique(dat$site))
predictFun <- function(x)
predict(x,newdata=nd,re.form=~(1|Year),type="response")
predBoot <- bootMer(m1, predictFun, use.u=FALSE, ...)
> I'm not sure how to choose use.u and type or whether just using predict as
> the function is sufficient. In a past comment, Ben Bolker talked about
> using FUN=predict vs. FUN=sumulate, but I'm not sure what the difference
> is. https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q3/020663.html
>
the difference between predict() and simulate() would essentially be the
difference between confidence intervals (not including residual variance)
and prediction intervals.
>
> What if I want the predictions back-transformed to the data scale (i.e. as
> probabilities)?
>
Isn't this what you're already getting?
Can you give a simple reproducible example?
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list