Tutorials › Generalized Linear Mixed Models (GLMM) › Hessian Checks at the Fitted Solution

Convergence, Singular Fits and Boundary Estimates · Tutorial 292 of 698

Hessian Checks at the Fitted Solution

Learn to check the curvature of a fitted GLMM objective, interpret a failed positive-definiteness check, and assess whether ordinary local uncertainty estimates are defensible.

Advanced 12 min read

What You'll Learn

  • Define the observed Hessian and information matrix using a consistent objective-sign convention.
  • Check positive definiteness at an interior fitted solution using curvature and leading principal minors.
  • Connect the inverse observed information to local standard errors and their limitations.
  • Recognize how numerical error, nonstationarity, and boundary constraints can affect the check.
  • Distinguish a Hessian check from gradient checks and from broader assessments of fit reliability.
  • Diagnose worked cases and explain why a successful check is necessary evidence, not proof of a trustworthy fit.

Why Check Curvature at a Fitted GLMM?

A convergence message reports that an optimizer stopped according to its criteria; it does not by itself establish that the reported parameter vector is a well-behaved local optimum. A Hessian check examines the curvature of the fitted objective nearby. This matters both for assessing the candidate solution and for the usual local calculation of standard errors. In a GLMM, the objective may be a marginal log-likelihood or an approximation to it, depending on the fitting method. The check must be applied to the same objective that was actually optimized.

The sign convention is important. A likelihood maximizer should have downward curvature, whereas a minimizer of negative log-likelihood should have upward curvature. The criterion is the same once the sign is made explicit. Here \(\ell(\theta)\) denotes the log-likelihood or the likelihood approximation being optimized, and \(\theta\) denotes the vector of free parameters in the coordinates used by the optimizer.

Definition: The observed Hessian of the log-likelihood at \(\hat{\theta}\) is the matrix of second partial derivatives \(H_{\ell}(\hat{\theta})=\left[\partial^2\ell(\theta)/\partial\theta_j\partial\theta_k\right]_{\theta=\hat{\theta}}\). The observed information is \(J(\hat{\theta})=-H_{\ell}(\hat{\theta})\). For an interior, nondegenerate local maximum, \(H_{\ell}(\hat{\theta})\) is negative definite, equivalently \(J(\hat{\theta})\) is positive definite. If software minimizes \(q(\theta)=-\ell(\theta)\), its Hessian is \(H_q(\hat{\theta})=J(\hat{\theta})\).

Positive definite means that \(v^\mathsf{T}Jv>0\) for every nonzero vector \(v\). Thus the local objective curves upward in every parameter direction when minimizing negative log-likelihood. This is a strict local-curvature condition. It is not a statement about the objective everywhere, nor does it certify that the optimizer found the best solution among all possible solutions.

Why the Check Connects to Local Uncertainty

Suppose the objective is twice continuously differentiable near an interior fitted solution and the gradient is zero there. A second-order Taylor expansion of the negative log-likelihood gives, for a small displacement \(d\),

$$ q(\hat{\theta}+d) \approx q(\hat{\theta})+ \frac{1}{2}d^\mathsf{T}J(\hat{\theta})d. $$

The linear term is absent because the gradient vanishes at a stationary point. If \(J\) is positive definite, this quadratic approximation has a unique local minimum at \(d=0\). Under the usual large-sample likelihood approximation, the corresponding local likelihood for \(d\) is proportional to \(\exp\{-d^\mathsf{T}Jd/2\}\), whose covariance matrix is \(J^{-1}\). This is the basis for the familiar approximate covariance and standard errors:

$$ \widehat{\operatorname{Var}}(\hat{\theta})\approx J(\hat{\theta})^{-1}, \qquad SE(\hat{\theta}_j)\approx\sqrt{\left[J(\hat{\theta})^{-1}\right]_{jj}}. $$

These are local, model-based approximations, not universal uncertainty guarantees. They require a suitable likelihood approximation, adequate data for the approximation, and a fit for which the local quadratic description is meaningful. A Hessian can be positive definite while uncertainty estimates remain poor for other reasons, including weak information in the data or a misspecified model.

How to Carry Out and Interpret the Check

The Hessian should be evaluated at the final parameter values, using the exact objective and parameterization associated with the fit. Analytical derivatives are useful when available; numerical derivatives can be used, but depend on finite-difference steps and numerical precision. Since the exact Hessian is symmetric for a sufficiently smooth objective, noticeable asymmetry in a computed matrix is a warning to check derivative accuracy, parameter scaling, and the objective evaluation before interpreting its curvature.

For a symmetric matrix, positive definiteness can be checked by a Cholesky factorization: a successful factorization with positive diagonal entries establishes positive definiteness. For a small matrix, Sylvester’s criterion gives an equivalent check: all leading principal minors must be positive. Neither a small gradient nor an optimizer’s convergence flag replaces this check; the gradient concerns first derivatives, while the Hessian concerns local second-order behavior.

1
Confirm the target and coordinates.
Identify whether the software minimized negative log-likelihood, deviance, or another objective, and which free parameter coordinates its Hessian uses.
2
Evaluate curvature at the reported fit.
Compute the Hessian at the final parameter vector. Check that the numerical matrix is sufficiently symmetric and that its entries are finite.
3
Check the appropriate sign and definiteness.
For negative log-likelihood minimization, check that its Hessian is positive definite. For log-likelihood maximization, check that the negative Hessian is positive definite.
4
Use the result as one piece of evidence.
If the check passes, examine whether the inverse information gives sensible uncertainty estimates and consider the gradient, constraints, and fit diagnostics as well. If it fails, do not treat the ordinary inverse-Hessian standard errors as reliable without further investigation.

Worked Example: A Positive-Definite Hessian and Local Standard Errors

Suppose a hypothetical GLMM fit has two fixed-effect parameters, an intercept and a treatment coefficient, both on the log-odds scale. The optimizer minimizes negative log-likelihood, and the computed Hessian at an interior fitted solution is

$$ H_q(\hat{\theta})= \begin{pmatrix} 12 & -2\\ -2 & 8 \end{pmatrix}. $$

For a symmetric \(2\times2\) matrix, Sylvester’s criterion requires the first leading principal minor and the determinant to be positive. Here they are

$$ 12>0, \qquad \det(H_q)=12(8)-(-2)^2=96-4=92>0. $$

The Hessian is therefore positive definite. Its inverse, used as the approximate covariance matrix for these two coefficients, is

$$ H_q^{-1} = \frac{1}{92} \begin{pmatrix} 8 & 2\\ 2 & 12 \end{pmatrix}. $$

The approximate standard errors are \(\sqrt{8/92}=0.2949\) for the intercept and \(\sqrt{12/92}=0.3612\) for the treatment coefficient. Both are in log-odds units. This check supports using the inverse-Hessian calculation as a local approximation; it does not establish that the model is correctly specified or that the treatment estimate has a causal interpretation.

What a Failed Check Means

A failed positive-definiteness check means that the computed curvature does not meet the condition for an ordinary, nondegenerate interior maximum or minimum under the stated sign convention. The pattern helps guide investigation, but a failure does not identify its own cause. Possible explanations include an optimizer that has not reached a stationary point, inaccurate numerical derivatives, an objective that is poorly behaved near the reported fit, or a solution on or near a constraint boundary. Some causes concern the numerical calculation; others indicate a genuine feature of the likelihood or parameter space.

If the observed information is indefinite, its inverse may have negative diagonal entries. Those entries cannot be interpreted as variances, so ordinary standard errors derived from that inverse are not meaningful. If the matrix is singular, the inverse does not exist. If it is positive definite but close to singular, inversion can still produce highly unstable uncertainty estimates. The next step is to examine the fit and computation rather than to report the output mechanically.

A useful comparison is with a gradient check. A small gradient suggests that first-order changes in the objective are small at the fitted point; it does not show that the point is a minimum or maximum. Conversely, positive-definite curvature alone does not show that the gradient is sufficiently small. Both are needed to support the interpretation of a smooth interior optimum. Further comparisons, such as profile-based likelihood intervals or resampling methods, can assess uncertainty in ways that are less dependent on a local quadratic approximation, but they do not make a failed fit automatically trustworthy.

Worked Example: An Indefinite Hessian Does Not Support Standard Errors

Consider a hypothetical two-parameter fit that minimizes negative log-likelihood. Its computed Hessian is

$$ H_q(\hat{\theta})= \begin{pmatrix} 5 & -4\\ -4 & 2 \end{pmatrix}. $$

The first leading principal minor is \(5>0\), but the determinant is

$$ \det(H_q)=5(2)-(-4)^2=10-16=-6<0. $$

Thus the Hessian is not positive definite. The direction \(d=(1,2)^\mathsf{T}\) makes the failure concrete:

$$ H_qd= \begin{pmatrix}-3\\0\end{pmatrix}, \qquad d^\mathsf{T}H_qd=-3<0. $$

There is downward curvature in this direction for an objective being minimized. The point therefore does not have the required local-minimum curvature. In this example, the matrix inverse has diagonal entries \(-1/3\) and \(-5/6\), which cannot serve as variance estimates. The appropriate conclusion is not that the parameters have “negative uncertainty,” but that this Hessian does not provide valid ordinary inverse-Hessian standard errors. The derivative calculation, stationarity, constraints, and optimization should be investigated.

Boundaries, Diagnostics, and Limitations

The interior condition matters. At a constrained optimum, a minimum may occur at the boundary even though the gradient is not zero in the usual unconstrained sense. For example, a variance parameter \(\tau\) is restricted to \(\tau\geq0\). If a negative log-likelihood is \(q(\tau)=q(0)+3\tau+2\tau^2\), then \(q'(\tau)=3+4\tau>0\) for \(\tau\geq0\), so the constrained minimum is at \(\hat{\tau}=0\). Its second derivative is \(q''(0)=4>0\), but the standard interior stationary-point argument does not apply: \(q'(0)=3\), and a symmetric, unconstrained quadratic approximation does not represent the one-sided parameter space. A positive Hessian in this case does not, by itself, validate ordinary symmetric standard errors at the boundary.

When a check fails, first verify that the Hessian belongs to the objective and parameter values actually reported. Then check numerical symmetry and derivative stability, and relate the result to the optimizer’s gradient and any parameter constraints. Re-evaluating derivatives more accurately or restarting optimization can help distinguish a numerical issue from a persistent feature of the fitted objective. If the failure persists, report that the usual local uncertainty calculation is unsupported and investigate the fit before drawing inferential conclusions.

A common mistake is to reason, “The optimizer converged, so the Hessian must be positive definite and the standard errors are valid.” Convergence criteria can be satisfied without establishing positive curvature, and positive curvature itself does not establish global optimality or model adequacy. The correction is to treat the Hessian check as a specific local diagnostic, alongside—not instead of—gradient checks, boundary assessment, and substantive model evaluation.

The check also depends on parameter coordinates. A smooth, one-to-one change of coordinates preserves the local character of a true stationary point, but numerical Hessians and the appearance of curvature can be affected by scaling and finite precision. A Hessian computed for a conditional random-effects mode is not automatically the Hessian of the marginal likelihood for fixed and covariance parameters. Always match the matrix to the inferential target.

Key takeaway: For an interior GLMM fit, positive definiteness of the observed information is necessary for the ordinary local quadratic approximation and inverse-Hessian covariance calculation. A failed check makes those standard errors suspect; a passed check is useful evidence, not a complete validation of the fit.

Worked Example: A Boundary Fit with Positive Curvature

Suppose a hypothetical variance parameter \(\tau\), measured in squared outcome units, is constrained to be nonnegative. Near zero, the fitted negative log-likelihood has the form

$$ q(\tau)=q(0)+3\tau+2\tau^2,\qquad \tau\geq0. $$

Its derivative is \(q'(\tau)=3+4\tau\), which is positive throughout the allowed region. Therefore the minimum over \(\tau\geq0\) occurs at \(\hat{\tau}=0\). Its second derivative is \(q''(\tau)=4\), so the one-dimensional Hessian at the boundary is positive.

A mechanical inverse-Hessian calculation would give \(1/4\), but treating this as the variance of an ordinary symmetric estimate would ignore the boundary and the nonzero one-sided slope. The calculation confirms positive curvature, not the usual interior likelihood approximation. The boundary status must therefore be included when assessing uncertainty and fit reliability.

Check Your Understanding

Try each question, then compare your reasoning with the solutions.

  1. A GLMM optimizer minimizes negative log-likelihood. What definiteness condition should the Hessian satisfy at a nondegenerate interior solution?
  2. For \(H=\begin{pmatrix}4&1\\1&3\end{pmatrix}\), determine whether \(H\) is positive definite using leading principal minors.
  3. Why does a non-positive-definite Hessian prevent routine interpretation of the inverse as a covariance matrix?
  4. A variance estimate is at zero, subject to a nonnegativity constraint. Why is a positive second derivative alone insufficient to justify an ordinary symmetric standard error?

Solutions. (1) It should be positive definite. (2) The first minor is \(4>0\), and the determinant is \(4(3)-1^2=11>0\), so \(H\) is positive definite. (3) An indefinite matrix can have an inverse with negative diagonal entries, which cannot be variances; a singular matrix has no inverse. (4) The fitted point is on a boundary, so the interior stationary-point argument and symmetric local approximation need not apply. The constraint and one-sided behavior must be considered.

Clinical Biostats