[R] confint.merMod(method="boot") {lme4} with user supplied FUN to bootMer fails

Ben Bolker bbolker at gmail.com
Tue Feb 10 22:59:30 CET 2015


Torbjørn Håkan Ergon <t.h.ergon <at> ibv.uio.no> writes:

> 
> Dear list,
> 
> I'm trying to supply a summary function to confint.merMod(method="boot")
>  {lme4} but get persistent
> errors. The following example generates the errors:
> 
> > fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
> > test = function(fit) fixef(fit)[1]
> > test(fm1)
> (Intercept) 
>    251.4051 
> > confint(fm1, method="boot", FUN=test)
> Computing bootstrap confidence intervals ...
> Error in set.seed(seed) : supplied seed is not a valid integer
> > confint(fm1, method="boot", FUN=test, seed=100)
> Computing bootstrap confidence intervals ...
> Error in if (use.u) NULL else ~0 : 
>   argument is not interpretable as logical
> > confint(fm1, method="boot", FUN=test, seed=100, use.u = FALSE)
> Computing bootstrap confidence intervals ...
> Error in match.arg(type) : 'arg' must be NULL or a character vector
> > confint(fm1, method="boot", FUN=test, seed=100, use.u = TRUE)
> Computing bootstrap confidence intervals ...
> Error in match.arg(type) : 'arg' must be NULL or a character vector
> >
> 
> Any help/hints/ideas?
> 

 It turns out (not documented!) that you can't use confint.merMod
(at present) with user-specified functions -- when it says ...
are arguments that can be passed through to bootMer, it actually
means "other than FUN or nsim" ...

This should be a reasonable workaround 

bb <- bootMer(fm1, nsim=100, FUN=test)
library("boot")
boot.ci(bb,type="perc")

Future lme4-related questions should probably go to 
r-sig-mixed-models at r-project.org ...

Future lme4-related questions should probably go 
> Cheers,
> 
> Torbjørn
> 
> 




More information about the R-help mailing list