| fastglm_wald_test | R Documentation |
Tests specified linear combinations of regression coefficients in a fitted model. A factor or interaction can be tested as a complete formula term, and a named contrast can compare coefficients without refitting.
fastglm_wald_test(
object,
terms = NULL,
contrast = NULL,
null = 0,
vcov. = NULL,
component = "all"
)
object |
a fastglm GLM (including negative-binomial and streaming GLMs), ordinal, truncated-count, hurdle, zero-inflated, or two-part fit. |
terms |
formula terms, or coefficient names for a matrix fit, to test
jointly. The default selects all formula terms or all matrix coefficients
except a coefficient named |
contrast |
numeric vector or matrix specifying linear combinations.
Named columns may select a subset of coefficients in any order; omitted
columns have weight zero. Unnamed contrasts must follow |
null |
hypothesized value for each selected coefficient or contrast; a scalar is repeated across hypotheses. The default is zero. |
vcov. |
optional coefficient covariance matrix, or a function of
|
component |
|
For contrast matrix L, coefficient estimate b, and covariance
V, the statistic is (L b - null)' solve(L V L', L b - null). Its
reference is chi-square with one degree of freedom per independent
contrast. This is a first-order approximation requiring asymptotically
normal, estimable coefficients and a consistent covariance for the sampling
design. It is not a finite-sample F test or a likelihood-ratio test.
Mean-bias-reduced estimates use the same first-order convention. Sparse
outcomes, extreme effects, and few independent clusters can make the
approximation inaccurate. Tests of regression coefficients do not assess
the common-slope restriction; use fastglm_po_test() for that hypothesis.
Nonconvergence, collapsed ordinal categories, nonestimable contrasts, and
missing or numerically singular contrast covariance return an unavailable
result with an explanation. Degrees of freedom are not reduced silently.
For aliased GLM coefficients, estimability is checked against the retained
dependence between design columns. No generalized inverse is used.
Tests concern regression coefficients, excluding dispersion or size
parameters. An estimated negative-binomial size at its numerical boundary
returns an unavailable result. Truncated, hurdle, and zero-inflated fits
use regression covariance accounting for estimated size in regular fits.
For fastglm_nb(), the default retains its conventional fixed-size GLM
covariance; to use joint observed information, supply the regression block
of vcov(object, full=TRUE). Supplied covariance must contain all regression coefficients,
including both components when applicable, even for a selected-component test.
Cross-component covariance is retained; it is not replaced with independent
component calculations. The covariance restrictions of fastglm_vcov()
continue to apply, including its restriction on adjusted two-part fits.
A fastglm_wald_test inheriting from fastglm_test and htest,
with statistic, degrees of freedom, p-value, availability, contrast estimates,
standard errors, null values, and the contrast matrix and its covariance.
Print the object directly or use as.data.frame() for numeric extraction.
fit <- fastglm_ordinal(Sat ~ Infl + Type + Cont, MASS::housing,
weights=Freq, firth=TRUE)
fastglm_wald_test(fit, terms="Type")
fastglm_wald_test(fit, contrast=c(InflHigh=1, InflMedium=-1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.