downstream_methods: Downstream methods

Description Usage Arguments Details Examples

Description

Methods have been written that allow glmmTMB objects to be used with several downstream packages that enable different forms of inference. For some methods (Anova and emmeans, but not effects at present), set the component argument to "cond" (conditional, the default), "zi" (zero-inflation) or "disp" (dispersion) in order to produce results for the corresponding part of a glmmTMB model.

In particular,

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Anova.glmmTMB(
  mod,
  type = c("II", "III", 2, 3),
  test.statistic = c("Chisq", "F"),
  component = "cond",
  vcov. = vcov(mod)[[component]],
  singular.ok,
  ...
)

Effect.glmmTMB(focal.predictors, mod, ...)

Arguments

mod

a glmmTMB model

type

type of test, "II", "III", 2, or 3. Roman numerals are equivalent to the corresponding Arabic numerals. See Anova for details.

test.statistic

unused: only valid choice is "Chisq" (i.e., Wald chi-squared test)

component

which component of the model to test/analyze ("cond", "zi", or "disp")

vcov.

variance-covariance matrix (usually extracted automatically)

singular.ok

OK to do ANOVA with singular models (unused) ?

...

Additional parameters that may be supported by the method.

focal.predictors

a character vector of one or more predictors in the model in any order.

Details

While the examples below are disabled for earlier versions of R, they may still work; it may be necessary to refer to private versions of methods, e.g. glmmTMB:::Anova.glmmTMB(model, ...).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
warp.lm <- glmmTMB(breaks ~ wool * tension, data = warpbreaks)
salamander1 <- readRDS(system.file("example_files","salamander1.rds",package="glmmTMB"))
if (require(emmeans)) {
    emmeans(warp.lm, poly ~ tension | wool)
    emmeans(salamander1, ~ mined, type="response")
    emmeans(salamander1, ~ mined, component="zi", type="response")
}
if (getRversion() >= "3.6.0") {
   if (require(car)) {
       Anova(warp.lm,type="III")
       Anova(salamander1)
       Anova(salamander1, component="zi")
   }
   if (require(effects)) {
       plot(allEffects(warp.lm))
       plot(allEffects(salamander1))
   }
}

Example output

sh: 1: cannot create /dev/null: Permission denied
Loading required package: emmeans
 mined response     SE  df lower.CL upper.CL
 yes      0.758 0.0432 639    0.663    0.832
 no       0.355 0.0279 639    0.302    0.411

Confidence level used: 0.95 
Intervals are back-transformed from the logit scale 
Loading required package: car
Loading required package: carData
sh: 1: cannot create /dev/null: Permission denied
Registered S3 methods overwritten by 'car':
  method                          from
  influence.merMod                lme4
  cooks.distance.influence.merMod lme4
  dfbeta.influence.merMod         lme4
  dfbetas.influence.merMod        lme4
Loading required package: effects
lattice theme set by effectsTheme()
See ?effectsTheme for details.

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