bootmer_methods: support methods for parametric bootstrapping

Description Usage Arguments Details Examples

Description

see refit and isLMM for details

Usage

1
2
3
4
5
## S3 method for class 'glmmTMB'
isLMM(object)

## S3 method for class 'glmmTMB'
refit(object, newresp, ...)

Arguments

object

a fitted glmmTMB object

newresp

a new response vector

...

additional arguments (for generic consistency; ignored)

Details

These methods are still somewhat experimental (check your results carefully!), but they should allow parametric bootstrapping. They work by copying and replacing the original response column in the data frame passed to glmmTMB, so they will only work properly if (1) the data frame is still available in the environment and (2) the response variable is specified as a single symbol (e.g. proportion or a two-column matrix constructed on the fly with cbind(). Untested with binomial models where the response is specified as a factor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
if (requireNamespace("lme4")) {
## Not run: 
   fm1 <- glmmTMB(count~mined+(1|spp),
                  ziformula=~mined,
                  data=Salamanders,
                  family=nbinom1)
   ## single parametric bootstrap step: refit with data simulated from original model
   fm1R <- refit(fm1, simulate(fm1)[[1]])
   ## the bootMer function from lme4 provides a wrapper for doing multiple refits
   ##   with a specified summary function
   b1 <- lme4::bootMer(fm1, FUN=function(x) fixef(x)$zi, nsim=20, .progress="txt")
   if (requireNamespace("boot")) {
      boot.ci(b1,type="perc")
    }

## End(Not run)
}

glmmTMB documentation built on July 20, 2021, 9:06 a.m.