buildGLMMadaptive {buildmer}R Documentation

Use buildmer to fit generalized linear mixed models using mixed_model from package GLMMadaptive

Description

Use buildmer to fit generalized linear mixed models using mixed_model from package GLMMadaptive

Usage

buildGLMMadaptive(
  formula,
  data = NULL,
  family,
  buildmerControl = buildmerControl()
)

Arguments

formula

A formula specifying both fixed and random effects using lme4 syntax. (Unlike mixed_model, buildGLMMadaptive does not use a separate random argument!)

data

See the general documentation under buildmer-package

family

See the general documentation under buildmer-package

buildmerControl

Control arguments for buildmer — see the general documentation under buildmerControl

Details

The fixed and random effects are to be passed as a single formula in lme4 format. This is internally split up into the appropriate fixed and random parts.

As GLMMadaptive can only fit models with a single random-effect grouping factor, having multiple different grouping factors will raise an error.

If multiple identical random-effect grouping factors are provided, they will be concatenated into a single grouping factor using the double-bar syntax, causing GLMMadaptive to assume a diagonal random-effects covariance matrix. In other words, (1|g) + (0+x|g) will correctly be treated as diagonal, but note the caveat: (a|g) + (b|g) will also be treated as fully diagonal, even if a and b are factors which might still have had correlations between their individual levels! This is a limitation of both GLMMadaptive and buildmer's approach to handling double bars.

See Also

buildmer-package

Examples


if (requireNamespace('GLMMadaptive')) {
# nonsensical model given these data
model <- buildGLMMadaptive(stress ~ vowel + (vowel|participant),
       family=binomial,data=vowels,buildmerControl=list(args=list(nAGQ=1)))
# or with double-bar syntax for a diagonal r.e. cov. matrix
model <- buildGLMMadaptive(stress ~ vowel + (vowel||participant),
       family=binomial,data=vowels,buildmerControl=list(args=list(nAGQ=1)))
}


[Package buildmer version 2.11 Index]