The score test is one of the "holy trinity" of likelihood-based tests,
alongside the Wald test (wald_test()) and the likelihood ratio test
(lrt()). All three are asymptotically equivalent under \(H_0\), but
they differ in what they require:
Wald test: Needs the MLE and its standard error — requires
fitting the alternative model.
LRT: Needs maximized log-likelihoods under both models —
requires fitting both.
Score test: Needs only the score and information at
\(\theta_0\) — requires fitting only the null model.
This makes the score test computationally attractive when the null model
is simple but the alternative is expensive to fit.
For the univariate case:
$$S = \frac{U(\theta_0)^2}{I(\theta_0)} \sim \chi^2_1$$
For the multivariate case with \(k\) parameters:
$$S = U(\theta_0)^\top I(\theta_0)^{-1} U(\theta_0) \sim \chi^2_k$$
The function detects scalar vs. vector input and dispatches accordingly.