buildGLMMadaptive | R Documentation |
buildmer
to fit generalized linear mixed models using mixed_model
from package GLMMadaptive
Use buildmer
to fit generalized linear mixed models using mixed_model
from package GLMMadaptive
buildGLMMadaptive(
formula,
data = NULL,
family,
buildmerControl = buildmerControl()
)
formula |
A formula specifying both fixed and random effects using |
data |
See the general documentation under |
family |
See the general documentation under |
buildmerControl |
Control arguments for buildmer — see the general documentation under |
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.
buildmer-package
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)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.