Learn R Programming

hypothesize (version 0.11.0)

score_test: Score Test (Lagrange Multiplier Test)

Description

Computes the score test statistic and p-value for testing whether a parameter equals a hypothesized value, using the score function and Fisher information evaluated at the null.

Usage

score_test(score, fisher_info, null_value = NULL)

Value

A hypothesis_test object of subclass score_test containing:

stat

The score statistic \(S\)

p.value

P-value from chi-squared distribution

dof

Degrees of freedom (1 for univariate, \(k\) for multivariate)

score

The input score value(s)

fisher_info

The input Fisher information

null_value

The input null hypothesis value (if provided)

Arguments

score

Numeric scalar or vector. The score function \(U(\theta_0) = \partial \ell / \partial \theta\) evaluated at the null value.

fisher_info

Numeric scalar or matrix. The Fisher information \(I(\theta_0)\) evaluated at the null value.

null_value

Optional. The null hypothesis value, stored for reference but not used in computation.

Details

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.

See Also

wald_test(), lrt() for the other members of the trinity

Examples

Run this code
# Univariate score test
score_test(score = 2, fisher_info = 2)

# Compare the trinity on the same problem
score_test(score = 2, fisher_info = 2)
wald_test(estimate = 6, se = sqrt(6/10), null_value = 5)

# Multivariate
score_test(score = c(1, 2), fisher_info = diag(c(1, 1)))

Run the code above in your browser using DataLab