[R-sig-ME] using stimulate(model) for parametric bootstrapping in lmer repeatabilities

Jenni Sanderson Jennifer.Louise.Sanderson at googlemail.com
Wed Jun 8 09:56:04 CEST 2011

Hi all,

I am currently doing a consistency analysis using an lmer model and
trying to use parametric bootstrapping for the confidence intervals.

My model is like this:


where E is the individual level for consistency analysis, A-D are
other fixed and random effects that I have to control for.

Following Nakagawa and Scheilzeth I can work out the repeatability
estimate using the following (as it is a binomial and the residual
variance is fixed at 1).

attr(lme4::VarCorr(model)$E, "stddev")^2 /
(1*(pi^2)/3 + attr(lme4::VarCorr(model)$E, "stddev")^2  +
attr(lme4::VarCorr(model)$C, "stddev")^2  +
attr(lme4::VarCorr(model)$D, "stddev")^2  )

My question is can I use stimulate(model) to generate values that I
can then use to do parametric bootstrap analysis and generate the
confidence intervals?

Something like this:

for (i in 1:niter) {
y[,I(i*2-1):I(i*2)]<-simulate(model)[,1]   }
for (i in 1:niter) {
rvalues[i]<- attr(lme4::VarCorr(mboot)$E, "stddev")^2/(1*(pi^2)/3 +
attr(lme4::VarCorr(mboot)$E, "stddev")^2  +
attr(lme4::VarCorr(mboot)$C, "stddev")^2  +
attr(lme4::VarCorr(mboot)$D, "stddev")^2  )}

In the guide to lme4 it says that stimulate() "generate simulations
based on the estimated fitted models (conditional on the estimated
values of both the random and fixed effects)", which sounds like
exactly what I would need to generate values for parametric
bootstrapping but I can't find any examples of where anyone has done

Any advice would be very much appreciated! Thank you very much.


Jenni Sanderson
PhD student - Conflict and Cooperation in Vertebrate Societies
University of Exeter

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