Documentation

A.12 Asymptotics: information, the covariance step, the delta method and the three tests

From curvature to standard errors and tests

What you will learn

  • State the large-sample distribution of a maximum-likelihood estimate, and the role of the information matrix.
  • Derive the \(R\) and \(S\) matrices of the covariance step from the objective, and the three covariance estimators (\(R^{-1}\), \(S^{-1}\), \(R^{-1}SR^{-1}\)).
  • Use the delta method for a function of the estimates, and the Wald, likelihood-ratio and score tests.

Prerequisites: A.3, A.4 and A.6.

The large-sample result

Let \(\ell(\psi)=\sum_i\ell_i(\psi)\) be the log-likelihood of \(N\) independent subjects and \(\hat\psi\) its maximiser. Under regularity conditions, as \(N\) grows,

\[ \hat\psi\ \approx\ N\bigl(\psi_0,\ \mathcal I(\psi_0)^{-1}\bigr),\qquad \mathcal I(\psi)=-\mathbb E\bigl[\nabla^2_\psi\ell\bigr]=\mathbb E\bigl[\nabla_\psi\ell\,\nabla_\psi\ell^{\mathsf T}\bigr], \]

with \(\mathcal I\) the Fisher information (the two forms are equal when the model is correct). The inverse of the information is the covariance of the estimate: a sharply curved log-likelihood means a precisely determined parameter. The standard errors of the program are square roots of the diagonal of an estimate of this inverse.

The matrices \(R\) and \(S\)

nlmx works with \(\mathrm{OFV}=-2\ell\), so derivatives of \(\ell\) are half the derivatives of OFV with a sign change. At the estimates, with \(\psi\) on its natural scale and central differences of step \(10^{-3}\max(\lvert\psi_k\rvert,10^{-3})\):

\[ R=\tfrac12\nabla^2_\psi\mathrm{OFV}\quad(\approx-\nabla^2\ell,\ \text{the observed information}),\qquad S=\sum_i\tfrac14\,\nabla_\psi\mathrm{OFV}_i\,\nabla_\psi\mathrm{OFV}_i^{\mathsf T}\quad(\text{the empirical score outer product}). \]

The factor \(\tfrac14\) in \(S\) is \((\tfrac12)^2\): the score of \(\ell_i\) is \(-\tfrac12\nabla\mathrm{OFV}_i\). Three covariance estimators follow.

Estimator Formula When it is right
r (model-based) \(R^{-1}\) the model is correct
s (score-based) \(S^{-1}\) the model is correct; noisier
rsr (sandwich, default) \(R^{-1}SR^{-1}\) also when the model is misspecified (for example the residual variance is wrong)

The sandwich is a correction: if the model is correct, \(S\approx R\) and the sandwich collapses to \(R^{-1}\); if the variance model is wrong, \(R\) and \(S\) disagree and the sandwich is the honest answer.

A worked illustration

Estimating a mean with the wrong variance. Ten observations \(y=2.1,\ 3.4,\ 0.8,\ 2.9,\ 4.2,\ 1.7,\ 3.6,\ 2.5,\ 0.9,\ 3.9\) (mean \(\hat\mu=2.6\), residual sum of squares \(13.18\), sample variance \(1.464\)). Fit \(y_i\sim N(\mu,\sigma^2)\) with \(\sigma^2\) fixed at 1 (the model is wrong: the data's variance is nearer 1.5). The objective is \(\mathrm{OFV}=\sum(y_i-\mu)^2/\sigma^2\), with

\[ \nabla\mathrm{OFV}_i=-\frac{2(y_i-\mu)}{\sigma^2},\qquad\nabla^2\mathrm{OFV}=\frac{2n}{\sigma^2}. \]
Quantity Value Standard error
\(R=\tfrac12\cdot2n/\sigma^2\) \(10\) \(R^{-1/2}=0.316\) (r)
\(S=\sum(y_i-\hat\mu)^2/\sigma^4\) \(13.18\) \(S^{-1/2}=0.275\) (s)
sandwich \(R^{-1}SR^{-1}=13.18/100\) \(0.1318\) \(0.363\) (rsr)
textbook \(s/\sqrt n\) \(0.383\)

The model-based standard error (0.316) trusts the wrong variance and is too small; the sandwich (0.363) recovers most of the way to the textbook value (0.383) without being told the right variance. (The remaining gap is the usual small-sample factor \(\sqrt{n/(n-1)}\): \(0.363\times\sqrt{10/9}=0.383\).)

Reported quantities

Quantity Definition
SE \(\sqrt{\operatorname{Cov}_{kk}}\)
RSE % \(100\,\mathrm{SE}/\lvert\hat\psi_k\rvert\)
95 % interval \(\hat\psi_k\pm1.96\,\mathrm{SE}\)
correlation of estimates \(\operatorname{Cov}_{kl}/\sqrt{\operatorname{Cov}_{kk}\operatorname{Cov}_{ll}}\)
condition number \(\lambda_{\max}/\lambda_{\min}\) of the correlation matrix (page A.4)

The curvature must describe a minimum. The inverted matrix is judged on its unit-diagonal scaling: a non-positive diagonal, a scaled eigenvalue below \(-10^{-6}\), or a rank deficiency means that no standard errors are written (the covariance step is reported as failed). An exactly unused parameter (zero row and column) is excluded from that judgement and listed as unused. A variance that has gone to its boundary (zero) breaks the regularity conditions of the large-sample result: standard errors near a boundary should be read with caution.

RSE is not a test. A large RSE says the parameter is imprecise; it does not by itself say the parameter is zero. For a parameter whose natural scale makes zero uninformative (a variance, a log-scale parameter), a relative error is more useful than for one that can legitimately be zero.

The delta method

For a smooth scalar function \(g(\hat\psi)\),

\[ \operatorname{Var}\bigl(g(\hat\psi)\bigr)\approx\nabla g^{\mathsf T}\,\widehat{\operatorname{Cov}}\,\nabla g, \]

the first-order propagation of the covariance through \(g\) (page A.5: a linear map of a normal vector is normal). nlmx evaluates \(\nabla g\) by central differences, for effects, curves and predictions in the exposure–response and forest commands.

A ratio with correlated estimates. Let \(g=\theta_1/\theta_2\) with \(\hat\theta_1=40\) (SE 2), \(\hat\theta_2=4\) (SE 0.4) and \(\operatorname{Cov}(\hat\theta_1,\hat\theta_2)=0.2\) (a correlation of \(0.25\)). The ratio is \(10\) and \(\nabla g=(1/\theta_2,\ -\theta_1/\theta_2^2)=(0.25,\ -2.5)\), so

\[ \operatorname{Var}(g)=0.25^2(4)+(-2.5)^2(0.16)+2(0.25)(-2.5)(0.2)=0.25+1.00-0.25=1.00,\qquad\mathrm{SE}=1.0 . \]

Ignoring the covariance would give \(\sqrt{0.25+1.00}=1.12\): here the positive correlation between numerator and denominator makes the ratio more precise than independence would suggest.

An odds ratio. A log-odds slope \(\hat\beta=0.42\) with \(\mathrm{SE}=0.15\) gives an odds ratio \(e^{0.42}=1.522\). The interval is formed on the log scale and transformed back: \(\exp(0.42\pm1.96\times0.15)=(1.134,\ 2.042)\). The delta method applied directly to the ratio gives \(\mathrm{SE}=1.522\times0.15=0.228\) and the symmetric interval \((1.075,\ 1.969)\). The two agree at the centre and the first respects that an odds ratio is positive and skewed; it is the one the program reports (pages A.17 and Chapter 33).

Three tests of \(H_0:\beta=\beta_0\)

Test Statistic Needs Distribution under \(H_0\)
Wald \((\hat\beta-\beta_0)^2/\operatorname{Var}(\hat\beta)\) the full model only \(\chi^2_1\) (approximately)
Likelihood ratio \(\Delta\mathrm{OFV}=\mathrm{OFV}_{\text{reduced}}-\mathrm{OFV}_{\text{full}}\) both models fitted \(\chi^2_d\), \(d\) = number of constrained parameters
Score \(U^{\mathsf T}\mathcal I^{-1}U\), with \(U=\nabla\ell\) at the reduced fit the reduced model only \(\chi^2_d\)

Asymptotically they agree; in a finite sample they differ, and the Wald test is the least reliable when the likelihood is far from quadratic (a variance near zero, an Emax parameter near infinity, a probability near 0 or 1). The score test needs only the reduced fit, which is why it can screen many candidate additions at once (the frozen covariate engine, Chapter 23, uses efficient score tests at the base solution).

Illustration. \(\hat\beta=0.25\) with \(\mathrm{SE}=0.10\): \(z=2.5\), Wald \(\chi^2=6.25\), \(p=0.0124\) (the same from \(z\): \(2\{1-\Phi(2.5)\}\)). A likelihood-ratio test of the same hypothesis, in a well-behaved model, would give \(\Delta\mathrm{OFV}\) near \(6.25\) as well; a \(\Delta\mathrm{OFV}\) of \(3.84\) is the 5 % line for one parameter (page A.5).

Conditions that fail in practice

Problem Why it matters Sign
a parameter at a boundary the large-sample normal approximation is invalid variance near zero, correlation near \(\pm1\); the near-boundary flags of the fit output
flat likelihood in some direction \(R\) is nearly singular huge standard errors; a condition number above 1000
small \(N\) the asymptotics have not arrived intervals too narrow; compare with the coverage found by simulation (page A.16)
a misspecified model \(R^{-1}\) is too small r and s estimates disagree; prefer rsr

Review checklist

  • Can you relate \(R\) and \(S\) to the derivatives of the OFV, and say where the \(\tfrac14\) comes from?
  • Can you say when the sandwich differs from \(R^{-1}\), and why?
  • Can you propagate a covariance through a function by the delta method?
  • Do you know when a Wald test is unreliable, and what to use instead?

See the previous page, the next page and the mathematical reference.