Torbjørn Håkan Ergon
2015-Feb-10 10:16 UTC
[R] confint.merMod(method="boot") {lme4} with user supplied FUN to bootMer fails
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? Cheers, Torbj?rn
Ben Bolker
2015-Feb-10 21:59 UTC
[R] confint.merMod(method="boot") {lme4} with user supplied FUN to bootMer fails
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 > >