anova.semireg: Tests for a Semi-Parametric Model

View source: R/semireg-anova.R

anova.semiregR Documentation

Tests for a Semi-Parametric Model

Description

Tests of the fixed effects and of the smooth terms of a semireg or semireg_tmb fit, with the package's own code (no lmerTest needed).

Usage

## S3 method for class 'semireg'
anova(object, type = c("III", "II", "I"), smooth = TRUE, ...)

Arguments

object

A semireg or semireg_tmb fit.

type

"III" (default), "II" or "I" (also 3, 2, 1): the type of the tests of the fixed effects. Type I is sequential (Satterthwaite F for gaussian fits, Wald chi-square otherwise); see anova.lmerMod for which type to use.

smooth

Logical: test the smooth terms (refits the model once per smooth block)? The default is TRUE.

...

Not used.

Details

Fixed effects: Type III (or II) tests from pm_anova(): for gaussian fits Wald F tests with Kenward-Roger df and the adjusted covariance (the df equal those of the same model fitted by nlme::lme); for generalized fits Wald chi-square tests. The fixed parts of the smooths (e.g. x and f:x for s(x, by = f)) are tested here: they are the straight-line parts of the curves.

Smooth terms: for each block of smooth random effects (one variance), the likelihood ratio test of the variance being zero, i.e. of the curve being its straight-line part: the model is refitted without the block (with the same fixed effects, so REML likelihoods can be compared for gaussian fits). The tests are those of varcomp(fit, test = TRUE): as the variance is on the boundary of its range under the null hypothesis, the reference is the mixture \frac12\chi^2_0 + \frac12\chi^2_1 (Self and Liang, 1987), and for the only random effect of a gaussian fit the exact null distribution of the restricted likelihood ratio (Crainiceanu and Ruppert, 2004), where the mixture is conservative; lmerTest::ranova() used the full chi-square, more conservative still. Column test names the distribution. For an s(x, f) smooth the block of the deviation curves tests whether the curves of the levels of f have the same shape. For small samples permlmer or bootmodels on fit$semer give resampling tests.

Value

A list of class "pm_semi_anova" with fixed (the table of the fixed effects) and smooth (a data frame: the variance of each smooth block, the log-likelihoods of the model with and without it, the likelihood ratio statistic, its p-value and the reference distribution), printed together. Advice on the type of tests is kept as for anova.lmerMod (see advice).

References

Crainiceanu, C. M. and Ruppert, D. (2004). Likelihood ratio tests in linear mixed models with one variance component. Journal of the Royal Statistical Society B, 66, 165-185.

Self, S. G. and Liang, K.-Y. (1987). Asymptotic properties of maximum likelihood estimators and likelihood ratio tests under nonstandard conditions. Journal of the American Statistical Association, 82, 605-610.

See Also

anova.lmerMod, varcomp, semipred

Examples

library(predictmeans)
data(Dialyzer, package = "nlme")
fm <- semireg(rate ~ s(pressure, QB, k = 6) + (1 | Subject), data = Dialyzer)
anova(fm)

predictmeans documentation built on Nov. 24, 2026, 5:10 p.m.