One Logistic Slope, Three Routes to a Test
A logistic regression slope can be tested in three standard ways: the Wald test uses the estimated slope and its standard error; the score test evaluates the slope score at the fit constrained by the null; and the likelihood-ratio test compares the maximized likelihoods under the unrestricted and null models. In large regular samples, these tests have the same limiting reference distribution. In a particular finite sample, however, they use different information and need not give identical statistics or decisions.
We will compare them in a particularly transparent logistic model. Two independent groups have covariate values \(x_0=0\) and \(x_1=1\), with group sizes \(n_0,n_1>0\). Let \(Y_j\) be the number of events in group \(j\). The model is
The target is the two-sided test \(H_0:\beta=0\) against \(H_1:\beta\ne 0\). Under the null, the two groups have a common event probability. Under the unrestricted model, the two group probabilities can differ. We assume independent binomial sampling, positive group sizes, and interior observed proportions when using the ordinary finite maximum-likelihood estimates below. The usual chi-square reference distributions are large-sample approximations under regularity conditions, including an identifiable model and an interior null fit with nonsingular information.
What Each Test Fits
In this two-group model, the unrestricted estimates are \(\hat p_j=Y_j/n_j\), and the slope is the difference of the groups’ estimated logits:
The restricted fit instead pools the event counts: \(\tilde p=(Y_0+Y_1)/(n_0+n_1)\). The score test needs this null fit, not the unrestricted estimate of \(\beta\). The likelihood-ratio test needs both fits. Keeping these fitting requirements distinct is essential when calculating or interpreting the three tests.
Worked Comparison With Explicit Counts
Worked Example: A Logistic Slope With Unequal Group Sizes
Suppose \(n_0=11,\;Y_0=3\) and \(n_1=9,\;Y_1=7\). Test \(H_0:\beta=0\) against a two-sided alternative. All four event and non-event counts are positive, so both fitted group probabilities are interior.
Unrestricted fit and Wald test. The estimated probabilities are \(\hat p_0=3/11\) and \(\hat p_1=7/9\). Thus
For independent binomial groups, the estimated variance of each group logit is \(1/[n_j\hat p_j(1-\hat p_j)]\). The two group estimates are independent, so the variance of their difference is the sum:
The standard error is \(\sqrt{463/420}\approx1.0494\). Therefore \(Z_W=2.2336/1.0494\approx2.1285\), and \(W=Z_W^2\approx4.5305\). The \(\chi^2_1\) p-value is approximately \(0.0333\).
Restricted fit and score test. Under \(H_0\), the pooled probability is \(\tilde p=(3+7)/(11+9)=1/2\). The null intercept is consequently \(\tilde\alpha=\operatorname{logit}(1/2)=0\). The slope score at this fit is \(U_\beta=Y_1-n_1\tilde p=7-9/2=2.5\). As derived below, its nuisance-adjusted information is \(1.2375\). Hence
The \(\chi^2_1\) p-value is approximately \(0.02465\).
Likelihood-ratio test. The unrestricted log-likelihood uses the two fitted probabilities \(3/11\) and \(7/9\); the null log-likelihood uses \(1/2\) in both groups. Binomial coefficients cancel in their difference, giving
Its \(\chi^2_1\) p-value is approximately \(0.0213\). The three p-values differ: Wald \(0.0333\), score \(0.02465\), and likelihood ratio \(0.0213\). At level \(0.025\), the score and likelihood-ratio tests reject, while the Wald test does not. In particular, the score p-value is below \(0.025\); the decision does not depend on rounding or an equality convention.
Why the Score Information Has This Form
The score calculation includes the intercept as a nuisance parameter: it must account for estimating the intercept under the null rather than treating it as known. The following derivation shows exactly how that adjustment enters.
Proof. Apart from terms constant in \(\alpha,\beta\), the log-likelihood is
Write \(p_j=\operatorname{logit}^{-1}(\alpha+\beta x_j)\). Differentiating with respect to the slope gives \(U_\beta=\sum_j x_j(Y_j-n_jp_j)\). Under \(H_0\), \(p_0=p_1=\tilde p\), and \(x_0=0,x_1=1\), so \(U_\beta=Y_1-n_1\tilde p\). The intercept score is \(U_\alpha=Y_0+Y_1-(n_0+n_1)\tilde p=0\), by the definition of the pooled estimate.
For a binomial logistic observation, the information contribution for a linear predictor is \(n_jp_j(1-p_j)\). Thus, at the null fit, the information matrix in the order \((\alpha,\beta)\) is
Adjusting for the nuisance intercept gives the Schur complement
The score statistic is the squared nuisance-adjusted score divided by this information. Since the restricted intercept score is zero, the adjusted slope score equals \(U_\beta\). The stated result follows. The count condition ensures \(0<\tilde p<1\), so both weights and the adjusted information are positive. \(\square\)
Worked Example: Checking the Restricted Score Numerically
For the counts in the first example, the null fit has \(\tilde p=1/2\), so \(w_0=11(1/2)(1/2)=2.75\) and \(w_1=9(1/2)(1/2)=2.25\). The adjusted information is
The null-fit slope score is \(7-9(1/2)=2.5\). Direct substitution gives \(S=6.25/1.2375=500/99\approx5.0505\), confirming the score statistic used above. Using the unrestricted probabilities \(3/11\) and \(7/9\) here would be a different calculation: the score test is specifically evaluated at the restricted fit.
Deriving the Likelihood-Ratio Comparison
For these two groups, the unrestricted model has one free probability for each group, while the null model constrains them to be equal. Their maximized log-likelihoods make the likelihood-ratio statistic especially direct to derive.
Derivation. The binomial log-likelihood for group \(j\), including its combinatorial constant, is \( \log {n_j\choose Y_j}+Y_j\log p_j+(n_j-Y_j)\log(1-p_j)\). At the unrestricted maximum, \(p_j=\hat p_j\); at the null maximum, both probabilities equal \(\tilde p\). Subtracting the null log-likelihood from the unrestricted one cancels the combinatorial constants. Multiplying the remaining difference by two gives the displayed expression. The statistic is nonnegative because the unrestricted model includes the null model and therefore cannot have a smaller maximized likelihood. Under the null and the stated regularity conditions, its asymptotic reference distribution is \(\chi^2_1\), since the null imposes one independent restriction. \(\square\)
Worked Example: A Different Sample With the Same Three Tests
Let \(n_0=n_1=10,\;Y_0=2,\;Y_1=6\). The unrestricted probabilities are \(0.2\) and \(0.6\), while the null pooled probability is \(8/20=0.4\). The slope estimate is
For the Wald test, the estimated variance is \(1/[10(0.2)(0.8)]+1/[10(0.6)(0.4)]=0.625+0.416667=25/24\). Thus \(Z_W=\log(6)/\sqrt{25/24}\approx1.7555\), \(W\approx3.0818\), and the two-sided \(\chi^2_1\) p-value is about \(0.079\).
For the score test, \(U_\beta=6-10(0.4)=2\), and each group weight is \(10(0.4)(0.6)=2.4\). The adjusted information is \((2.4)(2.4)/(2.4+2.4)=1.2\), so \(S=2^2/1.2=3.3333\), with p-value about \(0.068\).
For the likelihood-ratio test,
Its p-value is about \(0.063\). All three tests fail to reject at level \(0.05\), though their p-values are not identical. The calculations illustrate that similar conclusions do not imply the statistics are interchangeable.
Interpreting Differences and Avoiding Pitfalls
In the first example, the Wald statistic is smaller than the score and likelihood-ratio statistics, and its p-value lies above \(0.025\) while the other two lie below. This is not a contradiction: each statistic is built from a different aspect of the likelihood. The Wald test measures the unrestricted estimate relative to its estimated standard error; the score test measures the slope’s evidence at the null fit; and the likelihood-ratio test measures the loss in maximized log-likelihood when the null restriction is imposed. Their local equivalence explains why they often agree in large samples, not why they must agree exactly in finite samples.
A common mistake is to calculate the score statistic using the unrestricted slope estimate and the unrestricted information, or to call the score p-value “approximately at the cutoff” after rounding. The correction is to evaluate the score and its nuisance-adjusted information at the restricted fit, then compare the unrounded p-value with the chosen level. In the first example, \(S=500/99\) gives \(p\approx0.02465\), so the score test rejects at level \(0.025\).
There is also an important boundary caveat. If \(Y_0+Y_1=0\) or \(Y_0+Y_1=n_0+n_1\), the pooled null estimate is \(0\) or \(1\). Then \(w_0=w_1=0\), the restricted finite intercept does not exist, and the ordinary score statistic has zero information in its denominator. It is not valid to substitute these values into the interior score formula and report a \(0/0\) statistic as a test result. Boundary cases require separate treatment.
Check Your Understanding
Use the two-group logistic setup to answer these questions.
- Which fitted model supplies the slope estimate and standard error for a Wald test?
- For the score test, why is the pooled probability used under \(H_0:\beta=0\)?
- In the first worked example, what are the score statistic and its approximate p-value, and what is its decision at level \(0.025\)?
- Explain why the likelihood-ratio statistic compares two maximized log-likelihoods rather than two slope estimates.
- What goes wrong with the ordinary score information formula if the total number of events is zero?