Computes a common-slope test directly, without calculating
prediction losses or calibration summaries. Print the result for a compact
test table, or use as.data.frame() or broom::tidy() for reporting.
a fastglm_ordinal fit retaining its design and outcomes,
or an ordinal source fit with its original block reader.
Its original coefficient estimates are not used in the test. The requested
null is refitted and must converge, including if the original fit did not.
formula terms, or named matrix columns, to test jointly. For a common-slope fit, the default tests all location predictors. For a partial fit, the default selects all currently nonparallel terms. Complete factor and interaction blocks are selected together. Terms that already have common slopes add no restrictions; they are never tested for zero effects by this function.
"ML" (default) or "meanBR". The latter evaluates
the ordinary efficient score at a mean-bias-reduced null fit, with explicit
projection of the ordinary nuisance score. It can supply a finite null
under separation, but does not guarantee convergence or small-sample accuracy.
assessment data as in fastglm_ordinal_assess().
named list containing tol and/or maxit for refitting.
For a partial likelihood ratio test these controls apply to both models
and their constrained convergence checks.
also test each selected formula term or matrix column separately. For a common-slope model, tests share one null refit; each term-specific alternative relaxes only that term. For a partial model, each term-specific null restricts only that term, leaving other varying effects unrestricted. These tests require separate null fits.
"score" (default) for the expected-information ordinary
efficient score, or "lr" for a likelihood ratio test of a partial model.
Likelihood ratio tests require null.estimation="ML" and refit both
the full partial model and the constrained null by ML, including when
the supplied object was fitted with mean bias reduction.
A fastglm_po_test object inheriting from fastglm_test and htest,
with numeric statistic, degrees of freedom, p-value, availability, null
estimation method, tested terms, and detailed fitting diagnostics.
With by.term=TRUE, a fastglm_test_list containing the joint and
term-specific tests in $tests, with print and data-frame methods.
Both null-estimation choices for score tests use expected information and an asymptotic chi-square reference. Mean bias reduction gives a first-order equivalent score test under a regular interior null with fixed predictor and category dimensions. The nuisance projection is essential because the ordinary nuisance score is nonzero at a bias-reduced root. This is not an adjusted-score test with established higher-order accuracy. It can be conservative in small samples. The method never switches null estimators automatically. The fitted link is retained. For logit models the hypothesis is proportional odds; for probit and complementary log-log models it is the common-slope restriction on that link's scale.
For a partial model, a selected predictor with slopes gamma[,j] is tested
through gamma[,j] - gamma[,1] = 0 for every threshold after the first.
Other varying effects remain unrestricted in both the null and alternative.
If s selected design columns have varying slopes across K categories,
this imposes s*(K-2) independent restrictions. Binary outcomes and
selections containing only already-common terms return an unavailable
test with zero degrees of freedom and an explanation.
For partial score tests, null.estimation="meanBR" fits bias reduction
in the reduced null model, embeds that estimate in the full partial model,
and projects its ordinary score using full-model expected information.
This preserves the common-slope test convention. It differs from
fastglm_score_test() with null.estimation="meanBR", which uses the
full-model adjustment in constrained fitting and in the score statistic.
Likelihood ratio tests use ordinary ML likelihoods and first-order
chi-square references; an unsuccessful full or constrained fit is reported
as unavailable. No finite-sample or higher-order calibration is claimed.
Empty categories and deficient predictor rank remain unsupported. A
sufficient separation check identifies two-valued predictors with a level
observed only in an endpoint category. It does not detect all forms of
separation; other unsuccessful null fits retain their convergence details.
See fastglm_ordinal_assess() for the hypothesis, assumptions, and frequency
conventions, and fastglm-test-methods for result extraction.
With by.term=TRUE, term-specific p-values are unadjusted for multiple
testing. The joint test remains the single test of all selected terms.
An ordinal source fit is tested on its original source when newdata and
y are omitted. The source is replayed for refitting and information
accumulation without collecting its design or outcomes. Recorded frequency
weights and offsets are used; overrides require explicit evaluation data.
Score tests retain the same null-estimation and term-selection conventions
as dense fits. Partial-model likelihood ratio tests fit the equivalent
reduced common-slope model and the full model by streamed ML. Memory is
bounded by one source block and coefficient-sized matrices, in addition to
the fitted source's existing block metadata. The reader must reproduce the
same observations on every pass, as required for source fitting itself.
Kosmidis, I. (2014). Improved estimation in cumulative link models. Journal of the Royal Statistical Society, Series B, 76, 169–196. doi:10.1111/rssb.12025 . The present meanBR option uses the ordinary projected score at a bias-reduced null, rather than the larger-model adjusted-score statistic discussed in Section 12 of that article.
fit <- fastglm_ordinal(Sat ~ Infl + Type + Cont, MASS::housing,
weights = Freq, firth = TRUE)
fastglm_po_test(fit)
#> Expected-information proportional-odds score test
#> Terms: Infl, Type, Cont
#> Null fit: maximum likelihood
#> Sample: 1681 observations represented by 72 rows
#>
#> Statistic df p-value
#> 8.729 6 0.1894
#>
#> Note: First-order chi-square approximation.
as.data.frame(fastglm_po_test(fit, terms = "Type"))
#> statistic df p.value null.estimation available
#> 1 5.907505 3 0.116198 ML TRUE