Tutorials › Multivariate Statistics (Graduate) › Deriving Gaussian Maximum-Likelihood Estimates

Multivariate Regression Models · Tutorial 296 of 975

Deriving Gaussian Maximum-Likelihood Estimates

Work from the matrix-normal likelihood to derive the regression coefficient and error-covariance maximum-likelihood estimates, including the conditions for a finite covariance estimate.

Intermediate 11 min read

What You'll Learn

  • Write the matrix-normal likelihood for a multivariate linear model with independent rows
  • Prove that maximizing over the coefficient matrix gives the ordinary least-squares estimate
  • Derive the covariance estimate by minimizing the likelihood objective in a whitened parameterization
  • Identify the conditions under which the covariance maximum-likelihood estimate exists
  • Distinguish the divisor in the likelihood estimate from the residual degrees of freedom

From the Gaussian Model to Maximum Likelihood

In multivariate regression, each case contributes a vector of responses, and the responses within a case may be correlated. The Gaussian likelihood accounts for that correlation through a common covariance matrix. Deriving its maximum clarifies two important facts: the coefficient estimate is the ordinary least-squares estimate, while the covariance estimate uses the residual sum-of-squares-and-cross-products matrix divided by the number of cases.

Let \(Y\) be an \(n\times p\) response matrix, \(X\) an \(n\times q\) design matrix of full column rank, \(B\) a \(q\times p\) coefficient matrix, and \(\Sigma\) a \(p\times p\) positive-definite covariance matrix. Assume the rows of \(Y\) are independent and that row \(i\) has a \(p\)-variate normal distribution with mean given by row \(i\) of \(XB\) and covariance \(\Sigma\). Equivalently, the errors have a matrix-normal distribution with independent rows and column covariance \(\Sigma\).

Definition: For \(R=Y-XB\), the matrix-normal likelihood, viewed as a function of \(B\) and positive-definite \(\Sigma\), is
$$ L(B,\Sigma)=(2\pi)^{-np/2}|\Sigma|^{-n/2} \exp\!\left[-\frac12\operatorname{tr}\{\Sigma^{-1}(Y-XB)'(Y-XB)\}\right]. $$
Here \(|\Sigma|\) denotes the determinant and \(\operatorname{tr}\) the trace. The maximum-likelihood estimates are the parameter values that maximize this likelihood over the stated parameter space.

Assume throughout that \(X\) has rank \(q\). Define the ordinary least-squares coefficient matrix and its residual sum-of-squares-and-cross-products matrix by

$$ \hat B=(X'X)^{-1}X'Y,\qquad \hat R=Y-X\hat B,\qquad S=\hat R'\hat R. $$

The likelihood analysis will show that \(\hat B\) is also the maximum-likelihood estimate. A finite, positive-definite covariance estimate exists when \(S\) is positive definite. This requires \(n-q\ge p\), since the rank of \(\hat R\) cannot exceed \(n-q\); that dimension condition alone is not sufficient, so positive definiteness of the observed \(S\) must also be checked.

Why the Coefficient Estimate Is Least Squares

Fix any positive-definite \(\Sigma\). Maximizing the likelihood over \(B\) is equivalent to minimizing \(\operatorname{tr}\{\Sigma^{-1}(Y-XB)'(Y-XB)\}\). To see where that criterion is minimized, write \(B=\hat B+D\), where \(D\) is any \(q\times p\) matrix. The least-squares residual satisfies \(X'\hat R=0\), so

$$ Y-XB=\hat R-XD,\qquad (Y-XB)'(Y-XB)=S+D'X'XD. $$

The cross-products vanish because \(\hat R'X=0\) and \(X'\hat R=0\). Thus the change in the trace criterion, relative to \(B=\hat B\), is

$$ \operatorname{tr}\{\Sigma^{-1}D'X'XD\}. $$

If \(D\ne 0\), then \(X'X\) is positive definite and \(\Sigma^{-1}\) is positive definite, making this trace strictly positive. For example, it equals the squared sum of the entries of \((X'X)^{1/2}D\Sigma^{-1/2}\), which is nonzero when \(D\ne0\). Therefore \(\hat B\) is the unique likelihood maximizer over \(B\) for each fixed \(\Sigma\). Importantly, this argument does not require uncorrelated responses: it holds for every positive-definite \(\Sigma\).

Theorem: If \(X\) has full column rank and \(\Sigma\) is positive definite, the unique maximizer of the matrix-normal likelihood over \(B\), with \(\Sigma\) held fixed, is \(\hat B=(X'X)^{-1}X'Y\). Consequently, the joint maximum-likelihood estimate of \(B\), whenever the joint maximum exists, is \(\hat B\).

The same result can be read directly from the likelihood: after substituting \(\hat B\), the residual matrix in the likelihood is \(\hat R\), so its quadratic term becomes \(\operatorname{tr}(\Sigma^{-1}S)\). The remaining task is to maximize over \(\Sigma\).

Worked Example: Estimating Coefficients and Covariance in a Two-Response Model

Consider an intercept-only model with \(n=3\) cases and two responses: \(X=(1,1,1)'\), and the rows of \(Y\) are \((1,2)\), \((2,1)\), and \((4,3)\). Find the maximum-likelihood estimates if a finite covariance estimate exists.

Here \(X'X=3\), and \(X'Y=(7,6)\). Hence

$$ \hat B=(X'X)^{-1}X'Y =\frac13(7,6) =\left(\frac73,2\right). $$

Subtract this fitted row from each observed row. The residual rows are \((-4/3,0)\), \((-1/3,-1)\), and \((5/3,1)\). Their cross-products give

$$ S= \begin{pmatrix} \frac{16}{9}+\frac{1}{9}+\frac{25}{9} & 0+\frac13+\frac53\\[2pt] 0+\frac13+\frac53 & 0+1+1 \end{pmatrix} = \begin{pmatrix} \frac{14}{3}&2\\ 2&2 \end{pmatrix}. $$

Its determinant is \((14/3)(2)-2^2=16/3>0\), and its leading diagonal entries are positive, so this symmetric matrix is positive definite. The covariance estimate derived below therefore exists. Since the likelihood covariance estimate is \(S/n\), in this example

$$ \hat\Sigma_{\mathrm{ML}} =\frac13S = \begin{pmatrix} \frac{14}{9}&\frac23\\[2pt] \frac23&\frac23 \end{pmatrix}. $$

The off-diagonal estimate records the positive residual cross-product between the two responses. The divisor is \(n=3\), not the residual degrees of freedom \(n-q=2\).

Maximizing the Likelihood over the Covariance

Substitute \(B=\hat B\) into the log-likelihood. Terms that do not involve \(\Sigma\) can be ignored for maximization, leaving

$$ \ell(\hat B,\Sigma) =\text{constant}-\frac12\left\{n\log|\Sigma|+ \operatorname{tr}(\Sigma^{-1}S)\right\}. $$

Suppose now that \(S\) is positive definite. Define \(C=S^{-1/2}\Sigma S^{-1/2}\), which is positive definite, so \(\Sigma=S^{1/2}CS^{1/2}\). This change of parameterization gives

$$ \log|\Sigma|=\log|S|+\log|C|,\qquad \operatorname{tr}(\Sigma^{-1}S)=\operatorname{tr}(C^{-1}). $$

The second identity follows from \(\Sigma^{-1}=S^{-1/2}C^{-1}S^{-1/2}\) and the cyclic property of the trace. Thus, apart from the constant \(n\log|S|\), maximizing the likelihood is equivalent to minimizing the objective \(n\log|C|+\operatorname{tr}(C^{-1})\).

Theorem: If \(S\) is positive definite, the unique maximum-likelihood estimate of \(\Sigma\), after maximizing over \(B\), is \(S/n\).

To prove this, let \(c_1,\ldots,c_p\) be the positive eigenvalues of \(C\). The determinant is the product of these eigenvalues, and the trace of \(C^{-1}\) is the sum of their reciprocals. The objective is therefore

$$ n\log|C|+\operatorname{tr}(C^{-1}) =\sum_{j=1}^{p}\left(n\log c_j+\frac{1}{c_j}\right). $$

For a single positive eigenvalue, define \(g(c)=n\log c+1/c\). Its derivative is

$$ g'(c)=\frac{n}{c}-\frac{1}{c^2} =\frac{nc-1}{c^2}. $$

This derivative is negative for \(0<c<1/n\) and positive for \(c>1/n\). Also, \(g(c)\) tends to infinity as \(c\) decreases to zero or increases without bound. It follows that \(g\) has its unique global minimum at \(c=1/n\). Each summand is minimized there, so the full objective has its unique minimum when all eigenvalues of \(C\) equal \(1/n\). A symmetric matrix with all eigenvalues equal to \(1/n\) is \(C=I_p/n\). Transforming back gives \(\Sigma=S^{1/2}(I_p/n)S^{1/2}=S/n\). This proves the result. \(\square\)

Worked Example: Checking the Covariance Objective’s Minimum

Suppose the residual SSCP is \(S=\operatorname{diag}(4,9)\) for \(n=6\) cases. Since \(S\) is positive definite, the covariance estimate is

$$ \hat\Sigma_{\mathrm{ML}}=\frac{S}{6} =\operatorname{diag}\left(\frac23,\frac32\right). $$

To check the optimization, the transformed matrix is \(C=S^{-1/2}\Sigma S^{-1/2}\). At the estimate it is \(I_2/6\), so both eigenvalues are \(1/6\). Each eigenvalue contributes \(6\log(1/6)+6\) to the objective \(6\log|C|+\operatorname{tr}(C^{-1})\). If instead an eigenvalue were \(1\), its contribution would be \(6\log(1)+1=1\), whereas at \(1/6\) it is \(6-6\log 6\), which is smaller. More generally, the derivative argument above establishes the unique minimum at \(1/6\), not at \(1\). The factor \(n\) on the log-determinant term is essential to this conclusion.

When Does a Finite Covariance Estimate Exist?

The positive-definiteness condition on \(S\) is not a technical convenience: it determines whether the likelihood has a finite maximizer in the positive-definite covariance parameter space. If \(S\) is singular, choose an orthonormal eigenbasis in which \(S\) has at least one zero eigenvalue. For illustration, let the eigenvalues be \(s_1,\ldots,s_r>0\), followed by \(p-r\) zeros. In this basis, consider covariance matrices with eigenvalues \(s_j/n\) in the positive-eigenvalue directions and \(\varepsilon\) in each zero-eigenvalue direction, where \(\varepsilon>0\). Then \(\operatorname{tr}(\Sigma^{-1}S)=rn\), which stays fixed, while \(|\Sigma|\) tends to zero as \(\varepsilon\) tends to zero. Since the likelihood includes the factor \(|\Sigma|^{-n/2}\), the likelihood tends to infinity. Thus no finite positive-definite covariance MLE exists when \(S\) is singular.

Worked Example: Diagnosing a Nonexistent Finite Estimate

Suppose \(n=4\), the design has \(q=2\) linearly independent columns, and there are \(p=3\) responses. The residual matrix has at most \(n-q=2\) linearly independent columns, so \(\operatorname{rank}(S)\le2<3\). Therefore \(S\) is necessarily singular, regardless of the observed response values. The likelihood has no finite maximizer over positive-definite \(\Sigma\): a covariance eigenvalue can shrink toward zero in a zero-eigenvalue direction of \(S\), making the likelihood unbounded. In this design, the condition \(n-q\ge p\) fails, so a finite covariance MLE is impossible.

Common Pitfall and Practical Interpretation

A common mistake is to use the residual degrees of freedom in the covariance likelihood estimate and report \(S/(n-q)\). That divisor is associated with an unbiased covariance estimate under the model, not with the likelihood maximization performed here. The likelihood contains \(n\log|\Sigma|\), because the determinant contribution appears once for each of the \(n\) independent rows. Its optimization gives \(S/n\). The distinction between the maximum-likelihood and unbiased covariance estimates is important in applications; the likelihood derivation alone does not make the two estimates interchangeable.

Another tempting error is to omit the factor \(n\) while minimizing the transformed objective. The actual objective is \(n\log|C|+\operatorname{tr}(C^{-1})\), not \(\log|C|+\operatorname{tr}(C^{-1})\). Omitting \(n\) changes the eigenvalue minimizer and contradicts the likelihood’s determinant factor. Keeping the likelihood objective intact yields \(c_j=1/n\) for every eigenvalue and hence \(\hat\Sigma_{\mathrm{ML}}=S/n\).

Key takeaway: With a full-column-rank design and positive-definite residual SSCP \(S\), the joint Gaussian maximum-likelihood estimates are \(\hat B=(X'X)^{-1}X'Y\) and \(\hat\Sigma_{\mathrm{ML}}=S/n\). If \(S\) is singular, there is no finite positive-definite covariance MLE.

Check Your Understanding

Use the likelihood derivation and the existence conditions to answer these questions.

  1. Why does maximizing over \(B\) give the ordinary least-squares coefficient matrix even when the responses are correlated?
  2. In the covariance derivation, what is the eigenvalue objective for one eigenvalue \(c\), and where does it attain its minimum?
  3. For what condition on \(S\) does the finite positive-definite covariance estimate \(S/n\) exist?
  4. If \(n=10\), \(q=3\), and \(p=4\), is a positive-definite residual SSCP dimensionally possible? Explain.
  5. Why is \(S/(n-q)\) not the maximum-likelihood covariance estimate derived here?
Clinical Biostats