Tutorials › Nonlinear Mixed-Effects Models (NLME) › Turning the Hessian Into a Parameter Covariance Matrix

Bootstrap, Profile Likelihood and Parameter Uncertainty · Tutorial 610 of 797

Turning the Hessian Into a Parameter Covariance Matrix

You will invert the observed-information matrix to obtain a local covariance estimate, interpret its correlations, and diagnose when the result is unreliable.

Advanced 12 min read

What You'll Learn

  • Define observed information from the marginal log likelihood at the fitted parameter vector
  • Derive why inverse local curvature approximates parameter-estimate covariance
  • Invert a two-parameter information matrix and calculate standard errors and correlation
  • Convert covariance estimates between linearly rescaled parameter coordinates
  • Distinguish a valid covariance matrix from an invertible information matrix
  • Diagnose numerical, boundary, and identifiability problems that undermine the estimate

From Likelihood Curvature to Parameter Uncertainty

After fitting an NLME model, a point estimate alone does not describe how precisely the model parameters have been estimated. The curvature of the marginal likelihood near its maximum provides a local measure of that uncertainty. In particular, the inverse of the observed-information matrix estimates the covariance matrix of the fitted parameters. Its diagonal entries give estimated variances, while its off-diagonal entries describe how estimation errors in different parameters move together.

This is a local, model-based approximation, not a direct measurement of uncertainty and not the covariance matrix of the subject-level random effects. The calculation is meaningful only when the fitted solution and the likelihood surface meet suitable conditions. The earlier material on observed information from the marginal likelihood defines the curvature being used here; the focus now is its matrix inversion and interpretation.

Definition: Let \(\boldsymbol{\theta}=(\theta_1,\ldots,\theta_p)^\mathsf{T}\) be the vector of free NLME model parameters, and let \(\ell(\boldsymbol{\theta})\) be the marginal log likelihood for the observed data. At an interior maximum-likelihood estimate \(\hat{\boldsymbol{\theta}}\), the observed-information matrix is $$ \mathbf{J}(\hat{\boldsymbol{\theta}})=-\left.\frac{\partial^2 \ell(\boldsymbol{\theta})}{\partial\boldsymbol{\theta}\,\partial\boldsymbol{\theta}^\mathsf{T}}\right|_{\boldsymbol{\theta}=\hat{\boldsymbol{\theta}}}. $$ If the fitting algorithm minimizes the negative log likelihood, its Hessian at the estimate is the same matrix. When \(\mathbf{J}\) is nonsingular and positive definite, the inverse-information covariance estimate is \(\widehat{\operatorname{Cov}}(\hat{\boldsymbol{\theta}})=\mathbf{J}^{-1}\).

The parameter vector may include typical values, covariate effects, random-effects variance or covariance parameters, and residual-error parameters, depending on how the model is parameterized. Keep the parameter ordering fixed: row \(i\) and column \(j\) of both matrices must refer to the same parameters. Each entry of \(\mathbf{J}\) has units reciprocal to the product of the units of its row and column parameters. Its inverse therefore has the units of a parameter product, as required for a covariance matrix.

Why the Inverse Appears

The inverse is justified by the local shape of the likelihood. At an interior maximum, the first derivative is zero. A second-order Taylor expansion around \(\hat{\boldsymbol{\theta}}\) gives, for parameter vectors close to the estimate,

$$ \ell(\boldsymbol{\theta})\approx \ell(\hat{\boldsymbol{\theta}}) -\frac{1}{2}(\boldsymbol{\theta}-\hat{\boldsymbol{\theta}})^\mathsf{T} \mathbf{J}(\hat{\boldsymbol{\theta}}) (\boldsymbol{\theta}-\hat{\boldsymbol{\theta}}). $$

Exponentiating this approximation gives a likelihood proportional to a multivariate normal-shaped kernel centered at \(\hat{\boldsymbol{\theta}}\). A normal density with covariance matrix \(\mathbf{C}\) has quadratic term \((\boldsymbol{\theta}-\hat{\boldsymbol{\theta}})^\mathsf{T}\mathbf{C}^{-1}(\boldsymbol{\theta}-\hat{\boldsymbol{\theta}})\). Matching the two quadratic terms yields \(\mathbf{C}=\mathbf{J}^{-1}\). This explains the curvature calculation; it does not make the likelihood exactly normal. The covariance interpretation is an asymptotic, local approximation under regularity conditions.

In practice, the approximation is most defensible when the marginal likelihood is sufficiently smooth near the estimate, the solution is a well-defined interior maximum, and the parameters are locally identifiable. The information must be positive definite for its ordinary inverse to be a positive-definite covariance estimate. A valid covariance matrix more generally need only be positive semidefinite: it can be singular and have zero eigenvalues or zero diagonal entries. That broader fact does not make a singular information matrix invertible.

Worked Example: Inverting a Two-Parameter Information Matrix

Suppose a hypothetical NLME fit estimates clearance \(CL\), in L/h, and volume \(V\), in L. In that parameter order, suppose the observed information at the fitted maximum is

$$ \mathbf{J}= \begin{pmatrix} 100 & 30\\ 30 & 25 \end{pmatrix}. $$

The determinant is \(100(25)-30(30)=1600\), which is positive. The first diagonal entry is positive, so this symmetric two-by-two matrix is positive definite. Its inverse is

$$ \widehat{\operatorname{Cov}}(\hat{CL},\hat{V}) =\mathbf{J}^{-1} =\frac{1}{1600} \begin{pmatrix} 25 & -30\\ -30 & 100 \end{pmatrix} = \begin{pmatrix} 0.015625 & -0.01875\\ -0.01875 & 0.0625 \end{pmatrix}. $$

The estimated standard errors are the square roots of the diagonal entries: \(SE(\hat{CL})=\sqrt{0.015625}=0.125\) L/h and \(SE(\hat{V})=\sqrt{0.0625}=0.250\) L. The estimated correlation is the off-diagonal covariance divided by the product of the standard errors:

$$ \widehat{\operatorname{Corr}}(\hat{CL},\hat{V}) =\frac{-0.01875}{(0.125)(0.250)}=-0.600. $$

Thus, in the local approximation, estimation errors in clearance and volume are negatively correlated. If one incorrectly ignored the off-diagonal information terms and took reciprocal square roots of the information diagonal, the results would be \(1/\sqrt{100}=0.100\) L/h and \(1/\sqrt{25}=0.200\) L. Those are not the standard errors from the full matrix: the parameter correlation changes the marginal variances.

Reading the Matrix and Checking Its Scale

For a covariance estimate \(\mathbf{C}=\mathbf{J}^{-1}\), each diagonal entry \(C_{ii}\) estimates the variance of \(\hat{\theta}_i\), and \(\sqrt{C_{ii}}\) is its standard error in the parameter's units. The correlation for parameters \(i\) and \(j\) is

$$ \hat{\rho}_{ij}=\frac{C_{ij}}{\sqrt{C_{ii}C_{jj}}}. $$

For a valid covariance matrix, diagonal entries are nonnegative and correlations lie between \(-1\) and \(1\), when both variances are positive. A covariance matrix must be symmetric and positive semidefinite. If it is positive definite, it is also nonsingular; positive definiteness is required for the ordinary inverse-information estimate in this tutorial, not for every possible covariance matrix.

The values depend on the coordinates in which the Hessian was calculated. If an optimizer uses rescaled parameters, convert the covariance to the desired units before reporting standard errors. For a linear change of coordinates \(\boldsymbol{\theta}=\mathbf{A}\boldsymbol{\phi}+\mathbf{b}\), the covariance transforms exactly as \(\mathbf{C}_{\theta}=\mathbf{A}\mathbf{C}_{\phi}\mathbf{A}^\mathsf{T}\). This rule preserves both variances and covariances; scaling only the diagonal entries would generally be wrong.

Worked Example: Returning From Scaled Coordinates

Suppose a hypothetical fit is optimized using dimensionless coordinates \(\phi_1=CL/(10\ \mathrm{L/h})\) and \(\phi_2=V/(20\ \mathrm{L})\). In that coordinate system, suppose the inverse information is

$$ \mathbf{C}_{\phi}= \begin{pmatrix} 0.04 & -0.012\\ -0.012 & 0.09 \end{pmatrix}. $$

The matrix is symmetric; its diagonal entries are positive and its determinant is \(0.04(0.09)-(-0.012)^2=0.003456>0\), so it is positive definite. The conversion matrix from \(\boldsymbol{\phi}\) to \((CL,V)^\mathsf{T}\) is \(\mathbf{A}=\operatorname{diag}(10,20)\), with the scale factors carrying units L/h and L. Therefore,

$$ \mathbf{C}_{(CL,V)} =\mathbf{A}\mathbf{C}_{\phi}\mathbf{A}^\mathsf{T} = \begin{pmatrix} 10 & 0\\ 0 & 20 \end{pmatrix} \begin{pmatrix} 0.04 & -0.012\\ -0.012 & 0.09 \end{pmatrix} \begin{pmatrix} 10 & 0\\ 0 & 20 \end{pmatrix} = \begin{pmatrix} 4 & -2.4\\ -2.4 & 36 \end{pmatrix}. $$

On the original scales, the standard errors are \(\sqrt{4}=2.00\) L/h for clearance and \(\sqrt{36}=6.00\) L for volume. The correlation remains \(-2.4/[(2)(6)]=-0.200\); multiplying each coordinate by a positive scale changes covariance units and magnitude, but not correlation.

When Inversion Fails or Misleads

Numerical optimizers and numerical Hessian calculations can produce a matrix that is singular, nearly singular, or not positive definite. These outcomes should be investigated rather than repaired mechanically. A nearly singular information matrix has a direction of low curvature: some combination of parameters can change substantially while the likelihood changes little. The resulting inverse may have very large variances and correlations near \(1\) or \(-1\). This often signals weak identifiability, excessive parameterization, sparse information in the design, or parameters that the data cannot distinguish well.

The following two-parameter example shows why a matrix that fails the positive-definiteness check cannot supply the intended covariance estimate.

Worked Example: A Nonpositive Information Matrix

Suppose a hypothetical optimizer reports the symmetric matrix

$$ \mathbf{J}= \begin{pmatrix} 4 & 3\\ 3 & 2 \end{pmatrix}. $$

Its determinant is \(4(2)-3(3)=-1\), so it is not positive definite. The algebraic inverse exists, but it is

$$ \mathbf{J}^{-1} =\frac{1}{-1} \begin{pmatrix} 2 & -3\\ -3 & 4 \end{pmatrix} = \begin{pmatrix} -2 & 3\\ 3 & -4 \end{pmatrix}. $$

The diagonal entries are negative, which cannot represent variances. The calculation therefore does not yield a valid covariance estimate. Check whether the optimizer reached a maximum, whether parameters are at a boundary, and whether the Hessian was computed accurately at the reported solution. A saddle point, a boundary solution, finite-difference error, or a poorly identified model can all undermine the regular local approximation. Do not simply take absolute values of the negative entries or discard the off-diagonal terms.

A singular matrix deserves a separate interpretation. A matrix such as \(\begin{pmatrix}1&1\\1&1\end{pmatrix}\) is a valid positive-semidefinite covariance matrix: it represents two perfectly linearly dependent quantities with zero variance in their difference. But it has no ordinary inverse. Likewise, if the observed information is singular, its inverse cannot be used to obtain the ordinary covariance estimate. Generalized inverses or constraints may be useful in particular analyses, but they require an explicit model-specific interpretation and are not automatic substitutes for a failed inverse.

Before interpreting standard errors, inspect the fitted solution, the symmetry and eigenvalues of the information matrix, the magnitude of its condition number, and the resulting covariance and correlation matrices. Also compare the Hessian calculation across reasonable numerical settings if it was computed numerically. A positive-definite matrix is necessary for a nonsingular inverse-information covariance approximation, but it cannot by itself establish that the model is scientifically adequate or that the local approximation is accurate.

How This Approximation Compares With Alternatives

Observed information uses curvature from the actual fitted marginal log likelihood. Expected Fisher information instead uses the expectation of the information under the model; it describes average curvature across hypothetical data sets and may be more stable in some settings, but can be harder to calculate and need not match the observed curvature in a particular data set. Both rely on likelihood-based regularity and local asymptotic reasoning.

Profile likelihood and bootstrap approaches assess uncertainty through different calculations and can reveal asymmetry or behavior that a local quadratic approximation misses. They typically require more computation and their own assumptions and diagnostics. The inverse Hessian is attractive because it is readily available from many fitting procedures and summarizes joint local uncertainty in one matrix. It is least trustworthy when the likelihood is strongly nonquadratic, parameters are near boundaries, or the fit is weakly identified. It should be treated as one uncertainty assessment, not as a universal replacement for alternatives.

Key takeaway: Invert the observed-information matrix only after confirming that it is evaluated at a suitable interior maximum and is numerically positive definite. The resulting diagonal entries yield local parameter variances, and the off-diagonal entries are essential for understanding joint uncertainty and parameter correlations.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. For \(\mathbf{J}=\begin{pmatrix}9&0\\0&4\end{pmatrix}\), what are the estimated standard errors in the units of the first and second parameters?
  2. Why can a parameter's standard error not generally be obtained as the reciprocal square root of its diagonal entry in the information matrix?
  3. Can a singular matrix be a valid covariance matrix? Can a singular observed-information matrix be ordinarily inverted to obtain the covariance estimate described here?
  4. A computed inverse-information matrix has a negative diagonal entry. What should be concluded, and what should be checked?

Solutions. (1) The inverse is \(\begin{pmatrix}1/9&0\\0&1/4\end{pmatrix}\), so the standard errors are \(\sqrt{1/9}=1/3\) and \(\sqrt{1/4}=1/2\), in the respective parameter units. (2) Off-diagonal entries encode joint curvature. Inverting the full matrix generally changes its diagonal entries, so standard errors must come from the diagonal of \(\mathbf{J}^{-1}\), not from the diagonal of \(\mathbf{J}\) alone. (3) Yes. A covariance matrix may be positive semidefinite and singular. But a singular information matrix has no ordinary inverse, so it cannot produce this inverse-information estimate. (4) A negative diagonal is not a valid variance. Check the optimizer's solution and whether it is a maximum, boundary behavior, identifiability, parameter scaling, and numerical accuracy of the Hessian; do not reinterpret the negative value as a variance.