A result of glmer (the object it returned, not a copy), or an array of at least two fits of glmer, lmer and glm.
Optionaloptions: GlmerAnovaOptions
For one fit none; for several refit and names (see LmerCompareOptions).
// R: anova(lme4::glmer(y ~ x + f + (1 | g), data, family = binomial))
const data = {
y: [0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1],
x: [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6],
f: ["u", "v", "u", "v", "u", "v", "v", "u", "v", "u", "v", "u", "u", "v", "u", "v", "u", "v", "v", "u", "v", "u", "v", "u"],
g: ["a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "c", "d", "d", "d", "d", "d", "d"],
};
const fit = glmer("y ~ x + f + (1 | g)", data, { family: "binomial" });
const t = glmerAnova(fit);
t.terms; // ["x", "f"]
t.npar; // [1, 1]
t.F; // [3.6704, 0.83614]
// R: anova(lme4::glmer(y ~ x + (1 | g), data, family = binomial), fit)
const c = glmerAnova([glmer("y ~ x + (1 | g)", data, { family: "binomial" }), fit]);
c.npar; // [3, 4]
c.Chisq; // [NaN, 0.8673]
The ANOVA table of the fixed-effects terms of a generalized linear mixed model fitted by glmer, or, given an
array of fits, the likelihood-ratio comparison of the models. Equivalent to lme4::anova() in R.
For one fit: for each term of the fixed effects (in the order of the columns, the intercept left out), the
sequential Wald sum of squares, the squared length of the term's part of R_X β̂ (R_X the Cholesky factor of
R_X'R_X at the conditional mode), its number of columns (npar), the mean square and F = mean square / σ² (σ = 1
for binomial and poisson). As in lme4, there are no p-values (the statistics need not be F distributed).
For several fits: fits of glmer, lmer and glm together (at least one of glmer or lmer). The
glmer and lmer fits must be fitted to the same data object with the same rows and the same response (the left-hand
side of the formula); a glm fit must have the same number of observations and the same response values; all must
have the same prior weights. lmer's REML fits are refitted by maximum likelihood (unless refit: false); the models
are sorted by their number of parameters, and each is compared with the one before by the likelihood-ratio test
where that one is nested in it: the same family, link and offset (an lmer fit is gaussian with the identity link),
its fixed-effects columns in the column space of the larger fit's and its random-effects terms within the larger
fit's. Unlike R's, the log-likelihood of a glmer fit with nAGQ > 1 includes the saturated model's constant (see
glmer), so that it can be compared with the Laplace fit and with glm.
Optionaloptions: LmerCompareOptions
For one fit none; for several refit and names (see LmerCompareOptions).
// R: anova(lme4::glmer(y ~ x + f + (1 | g), data, family = binomial))
const data = {
y: [0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1],
x: [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6],
f: ["u", "v", "u", "v", "u", "v", "v", "u", "v", "u", "v", "u", "u", "v", "u", "v", "u", "v", "v", "u", "v", "u", "v", "u"],
g: ["a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "c", "d", "d", "d", "d", "d", "d"],
};
const fit = glmer("y ~ x + f + (1 | g)", data, { family: "binomial" });
const t = glmerAnova(fit);
t.terms; // ["x", "f"]
t.npar; // [1, 1]
t.F; // [3.6704, 0.83614]
// R: anova(lme4::glmer(y ~ x + (1 | g), data, family = binomial), fit)
const c = glmerAnova([glmer("y ~ x + (1 | g)", data, { family: "binomial" }), fit]);
c.npar; // [3, 4]
c.Chisq; // [NaN, 0.8673]
The ANOVA table of the fixed-effects terms of a generalized linear mixed model fitted by glmer, or, given an array of fits, the likelihood-ratio comparison of the models. Equivalent to
lme4::anova()in R.For one fit: for each term of the fixed effects (in the order of the columns, the intercept left out), the sequential Wald sum of squares, the squared length of the term's part of R_X β̂ (R_X the Cholesky factor of R_X'R_X at the conditional mode), its number of columns (
npar), the mean square and F = mean square / σ² (σ = 1 for binomial and poisson). As in lme4, there are no p-values (the statistics need not be F distributed).For several fits: fits of glmer, lmer and glm together (at least one of glmer or lmer). The glmer and lmer fits must be fitted to the same data object with the same rows and the same response (the left-hand side of the formula); a glm fit must have the same number of observations and the same response values; all must have the same prior weights. lmer's REML fits are refitted by maximum likelihood (unless
refit: false); the models are sorted by their number of parameters, and each is compared with the one before by the likelihood-ratio test where that one is nested in it: the same family, link and offset (an lmer fit is gaussian with the identity link), its fixed-effects columns in the column space of the larger fit's and its random-effects terms within the larger fit's. Unlike R's, the log-likelihood of a glmer fit withnAGQ > 1includes the saturated model's constant (see glmer), so that it can be compared with the Laplace fit and with glm.