Tutorials › Multivariate Statistics (Graduate) › Constrained Optimization for Multivariate Likelihoods

Resampling and Numerical Methods · Tutorial 973 of 975

Constrained Optimization for Multivariate Likelihoods

Build numerically stable likelihood optimizers that preserve covariance validity and distinguish genuine convergence from a merely small step.

Advanced 12 min read

What You'll Learn

  • Explain why a Gaussian covariance must be positive-definite and how Cholesky coordinates enforce that condition.
  • Derive the unconstrained Gaussian covariance likelihood optimum when the sample scatter is positive-definite.
  • Optimize a diagonal covariance model subject to a lower eigenvalue bound.
  • Apply Armijo backtracking and distinguish its decrease requirement from a cap on trial step length.
  • Interpret trust-region acceptance ratios and choose convergence diagnostics that respect constraints.

Why Constraints Matter in Likelihood Optimization

A numerical optimizer can produce a matrix that looks close to a covariance estimate but is not a valid covariance matrix. For a nonsingular multivariate Gaussian model, the covariance matrix must be symmetric positive-definite: every nonzero vector \(v\) must satisfy \(v^\mathsf{T}\Sigma v>0\). Positive-definiteness is a condition for the model to be valid, not a condition for every matrix operation to exist. A symmetric indefinite matrix can be invertible and can have positive determinant; a singular matrix has no inverse, and the real logarithm of its determinant is undefined when the determinant is nonpositive.

The practical task is therefore not just to optimize a likelihood, but to do so over a feasible set and in a way that remains numerically stable. This tutorial develops the main choices for covariance constraints, explains line-search and trust-region steps, and shows how to diagnose whether an algorithm has actually converged. The objective will usually be the negative log-likelihood, so optimization means minimizing it.

Definition: A real symmetric matrix \(\Sigma\) is positive-definite if \(v^\mathsf{T}\Sigma v>0\) for every nonzero vector \(v\). A constrained likelihood problem minimizes an objective \(f(\theta)\) over a specified feasible set \(\mathcal{C}\), rather than over all possible parameter values. For a nonsingular Gaussian model, \(\Sigma\) must belong to the positive-definite cone.

Cholesky Coordinates for Covariance Matrices

One direct way to enforce positive-definiteness is to optimize over a lower-triangular matrix \(L\) and set \(\Sigma=LL^\mathsf{T}\). If \(L\) is nonsingular, then \(v^\mathsf{T}LL^\mathsf{T}v=\|L^\mathsf{T}v\|^2>0\) for all nonzero \(v\), so the resulting covariance is positive-definite. Taking each diagonal entry of \(L\) to be an exponential of an unconstrained parameter ensures that it is positive.

Definition: In \(p\) dimensions, write \(L\) as lower triangular, with \(L_{ii}=\exp(\eta_i)\) on its diagonal and unrestricted real parameters below the diagonal. The map from \((\eta_i,L_{ij}:i>j)\) to \(\Sigma=LL^\mathsf{T}\) is a one-to-one parameterization of all \(p\times p\) positive-definite matrices.

The bijection follows from the Cholesky factorization. For completeness, its existence can be seen by induction on dimension. In dimension one, a positive scalar \(a\) factors as \((\sqrt a)^2\). For a larger positive-definite matrix, partition it as \(\begin{pmatrix}a&r^\mathsf{T}\\r&B\end{pmatrix}\), where \(a>0\). Its Schur complement \(B-rr^\mathsf{T}/a\) is positive-definite: for nonzero \(z\), apply positive-definiteness of the original matrix to \((-r^\mathsf{T}z/a,z^\mathsf{T})^\mathsf{T}\). By induction, that Schur complement has a Cholesky factor \(T\). Then \(L=\begin{pmatrix}\sqrt a&0\\r/\sqrt a&T\end{pmatrix}\) satisfies \(LL^\mathsf{T}=\Sigma\). This construction also determines each entry successively, giving uniqueness. Replacing each positive diagonal element by its logarithm gives unrestricted real coordinates. \(\square\)

Cholesky coordinates enforce positive-definiteness, but they do not automatically enforce every possible structural constraint. For example, a bound on a variance or correlation becomes a constraint on the entries of \(L\) and may need to be handled separately. Nor does setting selected off-diagonal entries of \(L\) to zero generally impose the corresponding covariance entries to be zero; the product \(LL^\mathsf{T}\) determines the covariance structure. Choose a parameterization that matches the actual model constraints.

Worked Example: Encoding a Two-Variable Covariance

For two variables, take \(L=\begin{pmatrix}a&0\\b&c\end{pmatrix}\), with \(a,c>0\). Then \(\Sigma=LL^\mathsf{T}=\begin{pmatrix}a^2&ab\\ab&b^2+c^2\end{pmatrix}\). Choose \(a=2\), \(b=0.5\), and \(c=\sqrt{1.75}\). This gives \(\Sigma=\begin{pmatrix}4&1\\1&2\end{pmatrix}\). Its leading diagonal entry is \(4>0\), and its determinant is \(4(2)-1^2=7>0\), confirming positive-definiteness. Equivalently, for every nonzero \(v\), \(v^\mathsf{T}\Sigma v=\|L^\mathsf{T}v\|^2>0\), since \(L\) is nonsingular.

If the diagonal entries are parameterized as \(a=\exp(\eta_1)\) and \(c=\exp(\eta_2)\), the optimizer can vary \(\eta_1,\eta_2,b\) over the real line without proposing an invalid covariance matrix. The displayed covariance corresponds to \(\eta_1=\log 2\), \(\eta_2=\log\sqrt{1.75}\), and \(b=0.5\).

A Gaussian Likelihood Example and Its Constrained Version

For independent Gaussian observations with known mean and positive-definite sample scatter \(S\), minimizing the negative log-likelihood over \(\Sigma\), apart from a positive constant factor, amounts to minimizing \(f(\Sigma)=\log\det\Sigma+\operatorname{tr}(\Sigma^{-1}S)\). Here \(S\) is the average outer product of the observations centered at the known mean. The next result identifies the unconstrained optimum and provides a useful benchmark for checking an optimizer.

Theorem: If \(S\) is positive-definite, the unique minimizer of \(f(\Sigma)\) over positive-definite \(\Sigma\) is \(\Sigma=S\).

Proof. Let \(A=S^{-1/2}\Sigma S^{-1/2}\), which is positive-definite, and let its eigenvalues be \(\lambda_1,\ldots,\lambda_p>0\). The determinant identity gives \(\log\det\Sigma=\log\det S+\log\det A\). The cyclic trace identity gives \(\operatorname{tr}(\Sigma^{-1}S)=\operatorname{tr}(A^{-1})\). Therefore \(f(\Sigma)-f(S)=\sum_{j=1}^{p}(\log\lambda_j+1/\lambda_j-1)\). For \(h(\lambda)=\log\lambda+1/\lambda-1\), its derivative is \(h'(\lambda)=(\lambda-1)/\lambda^2\). Thus \(h\) decreases up to \(1\), increases after \(1\), and has unique minimum \(h(1)=0\). The difference is nonnegative and is zero only when every eigenvalue of \(A\) is one, which for a symmetric positive-definite \(A\) means \(A=I\), or \(\Sigma=S\). \(\square\)

Worked Example: Checking the Unconstrained Gaussian Optimum

Suppose the observed scatter is \(S=\begin{pmatrix}4&1\\1&2\end{pmatrix}\). It is positive-definite because its leading diagonal entry is \(4>0\) and its determinant is \(7>0\). The theorem gives \(\hat\Sigma=S\). Its Cholesky factor is \(L=\begin{pmatrix}2&0\\0.5&\sqrt{1.75}\end{pmatrix}\), since \(LL^\mathsf{T}=S\).

At this estimate, \(\det\hat\Sigma=7\), so \(\log\det\hat\Sigma=\log 7\). Also \(\hat\Sigma^{-1}S=I_2\), hence \(\operatorname{tr}(\hat\Sigma^{-1}S)=2\). The objective is \(f(\hat\Sigma)=\log 7+2\), approximately \(3.946\). An implementation using the same objective and unconstrained model should reach this value up to numerical tolerance; a materially different result signals a possible optimization, parameterization, or numerical problem.

Constraints can change the optimum, even when the unconstrained estimate is known. A common example is a lower bound on eigenvalues to keep a covariance away from singularity. The constraint must be part of the statistical or numerical specification; it is not appropriate to add one silently just to make an optimizer behave.

Worked Example: A Diagonal Covariance With a Variance Floor

Consider a diagonal covariance \(\Sigma=\operatorname{diag}(\sigma_1,\sigma_2)\), with \(\sigma_1,\sigma_2\geq 0.1\), and scatter \(S=\operatorname{diag}(0.04,1)\). The objective, omitting a positive constant factor, is \(f=\log\sigma_1+0.04/\sigma_1+\log\sigma_2+1/\sigma_2\). For a component with scatter value \(s>0\), the derivative of \(\log\sigma+s/\sigma\) is \((\sigma-s)/\sigma^2\).

For the first component, \(s=0.04\); throughout the feasible range \(\sigma_1\geq0.1\), this derivative is positive, so the minimum occurs at \(\hat\sigma_1=0.1\). For the second component, \(s=1\); the derivative is negative below \(1\), zero at \(1\), and positive above \(1\). Since \(1\) is feasible, \(\hat\sigma_2=1\). Thus the constrained optimum is \(\hat\Sigma=\operatorname{diag}(0.1,1)\), with objective \(\log(0.1)+0.04/0.1+\log(1)+1=-2.302585+0.4+0+1\approx-0.902585\).

The unconstrained diagonal optimum would be \(\operatorname{diag}(0.04,1)\), but it violates the variance floor. This example is restricted to the diagonal model, where the two scalar minimizations separate; it does not assert that coordinatewise clipping gives the solution for a general, non-diagonal covariance problem.

Line Searches and Sufficient Decrease

Given a feasible parameter vector \(x\), an optimizer may choose a direction \(p\) and test points \(x+\alpha p\). For minimization, \(p\) is a descent direction when \(\nabla f(x)^\mathsf{T}p<0\). The Armijo condition accepts a trial step when \(f(x+\alpha p)\leq f(x)+c\alpha\nabla f(x)^\mathsf{T}p\), where \(0<c<1\). It requires a specified amount of decrease relative to the trial length and directional derivative.

A standard backtracking scheme starts from a chosen \(\alpha_0>0\), then repeatedly multiplies the trial length by \(\rho\in(0,1)\) until the Armijo condition holds. The cap on tested lengths in this procedure comes from the choice of \(\alpha_0\), not from Armijo itself. If constraints are handled in the original coordinates, every trial also needs to remain feasible; with a Cholesky parameterization, positive-definiteness is preserved for every finite parameter vector.

Result: Suppose \(f\) has a Lipschitz-continuous gradient in a neighborhood of \(x\), with constant \(M\), and the segment from \(x\) to \(x+\alpha p\) stays in that neighborhood. If \(\nabla f(x)^\mathsf{T}p<0\), Armijo backtracking with a positive initial trial length and reduction factor \(\rho\in(0,1)\) eventually accepts a step.

Proof. The Lipschitz-gradient condition implies the descent lemma \(f(x+\alpha p)\leq f(x)+\alpha\nabla f(x)^\mathsf{T}p+\frac{M}{2}\alpha^2\|p\|^2\). Write \(d=-\nabla f(x)^\mathsf{T}p>0\). The Armijo condition follows whenever \(\frac{M}{2}\alpha^2\|p\|^2\leq(1-c)\alpha d\). For \(M>0\), every positive \(\alpha\leq 2(1-c)d/(M\|p\|^2)\) satisfies this inequality. Backtracking produces trial lengths \(\alpha_0\rho^k\), which eventually fall below any fixed positive threshold. If \(M=0\), the descent lemma already gives the Armijo inequality for every positive trial length. Thus a trial is eventually accepted, provided its segment remains in the stated neighborhood. \(\square\)

Worked Example: Armijo Backtracking in One Dimension

Let \(f(x)=(x-3)^2\), start at \(x=0\), use the descent direction \(p=-f'(0)=6\), and set \(c=0.1\), \(\alpha_0=1\), and \(\rho=0.5\). Here \(f(0)=9\) and \(f'(0)p=(-6)(6)=-36\). At \(\alpha=1\), the trial point is \(6\), giving \(f(6)=9\), while the Armijo bound is \(9+0.1(1)(-36)=5.4\); the trial is rejected.

At \(\alpha=0.5\), the trial point is \(3\), giving \(f(3)=0\). The Armijo bound is \(9+0.1(0.5)(-36)=7.2\), so \(0\leq7.2\) and the trial is accepted. This example shows the decrease check directly; a covariance likelihood optimizer uses the same logic in its chosen coordinates, with feasibility handled as part of the method.

Trust Regions and Convergence Diagnostics

A line search chooses a direction and then scales it. A trust-region method instead limits the length of a proposed step and checks whether the objective behaves as its local model predicted. For example, for a quadratic model \(m(p)=f(x)+g^\mathsf{T}p+\frac12p^\mathsf{T}Bp\), define the ratio \(\rho_{\mathrm{TR}}=[f(x)-f(x+p)]/[m(0)-m(p)]\), when the predicted decrease \(m(0)-m(p)\) is positive. A small or negative ratio means the model predicted improvement that did not occur, so the step is rejected or the trust region is reduced; a ratio near one indicates a good prediction and may justify enlarging the region. Steps must still satisfy any constraints not already guaranteed by the parameterization.

A small change in objective alone is weak evidence of convergence: an algorithm can stagnate with a nonzero gradient, or make tiny steps because of poor scaling. A useful diagnostic set for constrained likelihood optimization includes:

  • The objective and its change across accepted iterations, with a check that minimization has not increased it beyond the method's stated tolerance.
  • The gradient norm in the coordinates actually optimized, together with a constraint-aware stationarity check when constraints are active.
  • Feasibility residuals, such as violations of bounds or equality constraints; for a covariance, also check symmetry and the smallest eigenvalue or a reliable Cholesky factorization.
  • Step size, line-search rejections or trust-region ratios, and warnings about ill-conditioning or overflow in transformed parameters.
  • Whether the stopping rule is relative to objective and parameter scales, and whether a different reasonable initialization reaches a compatible solution when the problem may have multiple local optima.

For a smooth problem with constraints, the gradient need not be zero at a constrained optimum. Instead, stationarity is expressed using feasible directions or, under appropriate regularity conditions, Karush–Kuhn–Tucker conditions. For example, if constraints are written \(g_i(x)\leq0\) and \(h_j(x)=0\), the KKT conditions include primal feasibility, nonnegative inequality multipliers, complementary slackness, and stationarity of the Lagrangian. A diagnostic that checks only the unconstrained gradient can therefore misclassify a valid boundary optimum.

Common Pitfalls

  • Assuming an indefinite matrix makes every likelihood calculation undefined. An indefinite matrix may be invertible and may have positive determinant. It is still not a valid Gaussian covariance. Check the model constraint, not just whether an inverse happens to exist.
  • Assuming Armijo puts an upper bound on the accepted step. It imposes a relative decrease requirement, not a universal maximum length. For \(f(x)=-x\), \(p=1\), and \(0<c<1\), the condition \(f(x+\alpha p)\leq f(x)+c\alpha f'(x)p\) reduces to \(-\alpha\leq-c\alpha\), which holds for every \(\alpha>0\). A particular backtracking algorithm's initial trial length \(\alpha_0\) supplies a cap on its tested steps.
  • Treating a small step as proof of optimality. A small step can result from scaling, a restrictive trust region, or repeated line-search contraction. Check stationarity and feasibility as well as step size.
  • Adding a covariance floor without recognizing its effect. A floor changes the feasible set and can change the estimate, as the diagonal example demonstrates. It should reflect the model or a stated regularization choice.
Key takeaway: Separate model validity, numerical parameterization, and optimization strategy. Cholesky coordinates preserve covariance positive-definiteness; constraints beyond positive-definiteness still require deliberate treatment; and convergence needs evidence from objective behavior, stationarity, and feasibility together.

Check Your Understanding

Use the definitions and calculations above to answer the following.

  1. Why can an invertible symmetric matrix with positive determinant still be invalid as a Gaussian covariance?
  2. For \(L=\begin{pmatrix}a&0\\b&c\end{pmatrix}\), write the covariance entries of \(LL^\mathsf{T}\), and state the conditions that ensure it is positive-definite.
  3. In the diagonal variance-floor example, why does the first variance estimate land on the boundary while the second does not?
  4. What does Armijo sufficient decrease require, and what separately determines the largest trial length in the specified backtracking scheme?
  5. Why can a constrained optimum have a nonzero unconstrained gradient, and what additional diagnostics should accompany a small step size?
Clinical Biostats