Sequential nested likelihood-ratio comparison of two or more ordinary
(ML, unpenalised, non-MSPL) gllvmTMB fits, sorted by increasing free
parameter count. Each adjacent pair is classified as either an
interior fixed-effect step (plain Wilks chi-square applies) or a
rank (boundary) step of exactly one new latent dimension (the
Self-Liang chi-bar-square mixture is used, as an explicitly documented
approximation – see Details). Anything else – more than one new latent
dimension in a step, a change to covstruct routes/family, or a fixed-effect
change combined with a rank change in the same step – is refused with a
named reason rather than guessed at.
Arguments
- object, ...
Two or more fits from
gllvmTMB().- test
One of
"chibar"(default: chi-bar-square for rank steps, plain chi-square for interior fixed-effect steps),"chisq"(plain chi-square everywhere – conservative (its p-value is too large, understating the evidence) at a rank/boundary step, and flagged as such in the returned table's notes), or"none"(report the table with no p-values).- x
An
"anova.gllvmTMB_multi"object.- digits
Number of significant digits printed in the comparison table.
Value
A data.frame of class c("anova.gllvmTMB_multi", "data.frame")
with columns model, formula, d (latent rank, NA if not
applicable), npar, logLik, deviance, df (parameter-count
change from the previous row), LRT, test (method actually used, or
"refused"), and p.value. An attribute "note" carries a per-row
explanation (recommended alternative when refused; the approximation
caveat for chi-bar rows).
Comparability (refused outright)
anova() aborts, naming the reason, if the fits: are not all
gllvmTMB_multi objects; include an LA-MSPL fit; include a REML = TRUE
fit; use different integration engines (Laplace vs AGHQ) or a loading
ridge; were fit to different data (row count, or the response itself), or
different families/links; or are not fixed-effect-nested when ordered by
parameter count. It also refuses (per-step, in the returned table's
test/note columns rather than aborting the whole call) any adjacent
pair that changes more than the latent rank d by more than one
dimension, or that changes both the fixed effects and the rank in the
same step – compare those in separate steps instead.
The rank-step chi-bar-square is an approximation
The Self & Liang (1987) chi-bar-square mixture (chibar2_pvalue()) is
derived for q INDEPENDENT scalar boundary variance components with
regular Fisher information elsewhere. A newly added latent-loading column
is p - d free parameters (this package's rr() lower-triangular
identifiability convention), but they are not literally independent
scalar variances: at the null (the new column exactly 0) the associated
latent score itself becomes unidentified, which is closer to the
"testing the number of factors" / reduced-rank-testing literature (known
to have non-standard LRT asymptotics in general) than to Self & Liang's
setting. anova() uses the chi-bar-square mixture as an approximation and
labels every rank-step p-value with this caveat in the table's notes rather
than presenting it as an exact result. Treat this result as a model-selection
aid, not as a generally calibrated hypothesis test.
