Tutorials › Multivariate Statistics (Graduate) › Maximum Likelihood Under Diagonal Gaussian Covariance

Gaussian Likelihood and Invariance · Tutorial 171 of 975

Maximum Likelihood Under Diagonal Gaussian Covariance

Learn how diagonal covariance separates the Gaussian likelihood into coordinatewise problems, and when the resulting maximum-likelihood estimates exist.

Intermediate 11 min read

What You'll Learn

  • Write the likelihood for independent multivariate normal observations with diagonal covariance.
  • Explain why the likelihood separates into independent coordinate contributions.
  • Derive the maximum-likelihood estimates of each mean and variance.
  • Distinguish the maximum-likelihood variance estimate from the unbiased sample variance.
  • Identify when a finite diagonal-covariance maximum-likelihood estimate does not exist.

Why a Diagonal Covariance Model Separates

When measurements on several variables are modeled jointly, the covariance matrix describes both their individual variability and their dependence. A diagonal covariance model makes a particular restriction: different coordinates have zero covariance. For a multivariate normal distribution, that restriction also means the coordinates are independent. This structure makes the likelihood simpler: each coordinate contributes a separate one-dimensional Gaussian likelihood, and each coordinate’s mean and variance can be estimated from its own observations.

We derive the estimates and state the condition under which they are genuine maxima. That condition matters: if the observed values of any coordinate are all identical, its variance can shrink toward zero and the likelihood has no finite maximum.

Model and Likelihood

Suppose \(X_1,\ldots,X_n\) are independent observations from a \(p\)-dimensional normal distribution with mean vector \(\mu=(\mu_1,\ldots,\mu_p)^\mathsf{T}\) and diagonal covariance matrix \(\Sigma\). Write \(X_i=(X_{i1},\ldots,X_{ip})^\mathsf{T}\), and let \(\Sigma=\operatorname{diag}(\sigma_1^2,\ldots,\sigma_p^2)\), where every \(\sigma_j^2>0\). The observed value of \(X_{ij}\) is denoted by \(x_{ij}\).

Definition: The diagonal Gaussian model consists of independent observations \(X_i\sim N_p(\mu,\Sigma)\), with \(\Sigma=\operatorname{diag}(\sigma_1^2,\ldots,\sigma_p^2)\) and positive diagonal entries. For each coordinate \(j\), define its sample mean and centered sum of squares by \(\bar{x}_j=n^{-1}\sum_{i=1}^n x_{ij}\) and \(S_j=\sum_{i=1}^n(x_{ij}-\bar{x}_j)^2\).

The density of one observation is the product of its \(p\) coordinate densities. Independence across observations then gives the full likelihood:

$$ L(\mu,\sigma_1^2,\ldots,\sigma_p^2) =(2\pi)^{-np/2} \prod_{j=1}^p\left[ (\sigma_j^2)^{-n/2} \exp\!\left\{-\frac{1}{2\sigma_j^2} \sum_{i=1}^n(x_{ij}-\mu_j)^2\right\} \right]. $$

The brackets are important: each coordinate’s variance factor and exponential term belong to the same coordinate-specific factor. Equivalently, collecting all exponential terms gives

$$ L(\mu,\sigma_1^2,\ldots,\sigma_p^2) =(2\pi)^{-np/2}\prod_{j=1}^p(\sigma_j^2)^{-n/2} \exp\!\left\{-\frac12\sum_{j=1}^p \frac{\sum_{i=1}^n(x_{ij}-\mu_j)^2}{\sigma_j^2}\right\}. $$

Taking logarithms turns the product into a sum:

$$ \ell(\mu,\sigma_1^2,\ldots,\sigma_p^2) =-\frac{np}{2}\log(2\pi) -\frac12\sum_{j=1}^p \left[ n\log(\sigma_j^2) +\frac{\sum_{i=1}^n(x_{ij}-\mu_j)^2}{\sigma_j^2} \right]. $$

Each summand involves only the parameters \(\mu_j,\sigma_j^2\) and the data in coordinate \(j\). Thus maximizing the whole likelihood is equivalent to maximizing each coordinate’s two-parameter likelihood separately. This follows directly from the multivariate normal density: its determinant term is \(|\Sigma|=\prod_j\sigma_j^2\), and its quadratic form is \(\sum_j(x_{ij}-\mu_j)^2/\sigma_j^2\). Both split into coordinate contributions, as does the likelihood across independent observations.

Deriving the Maximum-Likelihood Estimates

For a fixed coordinate \(j\), set \(Q_j(\mu_j)=\sum_{i=1}^n(x_{ij}-\mu_j)^2\). The identity \(Q_j(\mu_j)=S_j+n(\mu_j-\bar{x}_j)^2\) follows by writing \(x_{ij}-\mu_j=(x_{ij}-\bar{x}_j)+(\bar{x}_j-\mu_j)\) and using \(\sum_i(x_{ij}-\bar{x}_j)=0\). Therefore \(Q_j\) is minimized at \(\mu_j=\bar{x}_j\), with minimum \(S_j\).

Theorem: If \(S_j>0\) for every \(j=1,\ldots,p\), the diagonal Gaussian likelihood has a unique maximum at \(\hat{\mu}_j=\bar{x}_j\) and \(\hat{\sigma}_j^2=S_j/n\), for each coordinate \(j\). If \(S_j=0\) for at least one coordinate, the likelihood is unbounded above on the parameter space with strictly positive variances, so a finite maximum-likelihood estimate does not exist.

Proof. For fixed \(\sigma_j^2>0\), the coordinate log-likelihood is maximized by minimizing \(Q_j(\mu_j)\). The decomposition above shows that this unique minimizing mean is \(\bar{x}_j\). If \(S_j>0\), substituting that mean leaves, apart from a constant, the function of \(v=\sigma_j^2>0\)

$$ g_j(v)=-\frac n2\log v-\frac{S_j}{2v}. $$

Its derivative is \(g_j'(v)=(S_j-nv)/(2v^2)\), which is positive for \(0<v<S_j/n\) and negative for \(v>S_j/n\). Also, \(g_j(v)\to-\infty\) as \(v\downarrow0\) because \(S_j>0\), and \(g_j(v)\to-\infty\) as \(v\to\infty\). Hence its unique global maximum is at \(v=S_j/n\). Since the full log-likelihood is a sum of these coordinate log-likelihoods, the coordinatewise maxima give the unique joint maximum when every \(S_j>0\).

If \(S_j=0\), all observed values in coordinate \(j\) equal \(\bar{x}_j\). Set \(\mu_j=\bar{x}_j\); the residual sum of squares is then zero, and its log-likelihood contribution is \(-\tfrac n2\log v\). This tends to \(+\infty\) as \(v\downarrow0\). The other coordinates can be held at fixed admissible parameter values, so the full likelihood is unbounded above. Since \(v=0\) is not in the model, no finite maximum is attained. \(\square\)

The estimates are therefore

$$ \hat{\mu}= \begin{pmatrix}\bar{x}_1\\ \vdots\\ \bar{x}_p\end{pmatrix}, \qquad \hat{\Sigma} =\operatorname{diag}\left( \frac{S_1}{n},\ldots,\frac{S_p}{n} \right), $$

when all coordinates vary in the sample. The variance estimate uses denominator \(n\), not \(n-1\): maximum likelihood optimizes the likelihood, whereas the familiar \(n-1\) denominator gives an unbiased estimate of a univariate variance under the usual sampling assumptions.

Worked Examples

Worked Example: Estimating Two Coordinate Variances

Suppose the three observed vectors are \((1,2)^\mathsf{T}\), \((3,0)^\mathsf{T}\), and \((5,4)^\mathsf{T}\). Find the diagonal Gaussian maximum-likelihood estimates.

For coordinate 1, the observations are \(1,3,5\), so \(\bar{x}_1=(1+3+5)/3=3\). The centered sum of squares is \(S_1=(1-3)^2+(3-3)^2+(5-3)^2=4+0+4=8\), giving \(\hat{\sigma}_1^2=8/3\).

For coordinate 2, the observations are \(2,0,4\), so \(\bar{x}_2=(2+0+4)/3=2\). Here \(S_2=(2-2)^2+(0-2)^2+(4-2)^2=0+4+4=8\), and \(\hat{\sigma}_2^2=8/3\). Both sums of squares are positive, so the maximum exists. The estimates are \(\hat{\mu}=(3,2)^\mathsf{T}\) and \(\hat{\Sigma}=\operatorname{diag}(8/3,8/3)\).

Worked Example: Checking the Maximized Log-Likelihood

For observations \((0,1)^\mathsf{T}\) and \((2,5)^\mathsf{T}\), calculate the estimates and the maximized log-likelihood.

The coordinate means are \(\bar{x}_1=(0+2)/2=1\) and \(\bar{x}_2=(1+5)/2=3\). The centered sums of squares are \(S_1=(0-1)^2+(2-1)^2=2\) and \(S_2=(1-3)^2+(5-3)^2=8\). Since \(n=2\), the estimated variances are \(1\) and \(4\), respectively. Both are positive, so the maximum exists.

At these estimates, the log-likelihood is \[ -\frac{2\cdot2}{2}\log(2\pi) -\frac{2}{2}\{\log(1)+\log(4)\} -\frac12\left\{\frac{2}{1}+\frac{8}{4}\right\}. \] The three terms are \(-2\log(2\pi)\), \(-\log 4\), and \(-2\). Thus \(\ell_{\max}=-2\log(2\pi)-\log 4-2\). The last term confirms that each coordinate contributes its own residual sum of squares divided by twice its fitted variance.

Worked Example: A Coordinate With No Observed Variation

Suppose three observations in two dimensions are \((2,1)^\mathsf{T}\), \((2,2)^\mathsf{T}\), and \((2,4)^\mathsf{T}\). Determine whether a finite maximum-likelihood estimate exists.

In coordinate 1, all three values equal 2, so \(\bar{x}_1=2\) and \(S_1=0\). In coordinate 2, \(\bar{x}_2=(1+2+4)/3=7/3\), and \(S_2=(1-7/3)^2+(2-7/3)^2+(4-7/3)^2 =16/9+1/9+25/9=14/3\). Its fitted variance would be \(S_2/3=14/9\).

The second coordinate has an ordinary finite optimum, but coordinate 1 does not. Set its mean to 2 and its variance to \(v>0\). Its likelihood factor is proportional to \(v^{-3/2}\), because every residual is zero. As \(v\downarrow0\), this factor tends to \(+\infty\). Keeping the second coordinate’s parameters fixed at their finite optimum therefore makes the full likelihood unbounded. There is no finite joint maximum, despite the nonconstant observations in the second coordinate.

Interpretation and Common Pitfalls

The diagonal restriction does more than set estimated off-diagonal covariances to zero after fitting an unrestricted model. It defines a restricted likelihood in which coordinate \(j\)'s parameters are estimated from coordinate \(j\)'s observations alone. The fitted covariance matrix is diagonal by construction; the data do not supply estimates of cross-coordinate covariance parameters in this model.

  • Putting an exponential outside the coordinate product. The likelihood must include one exponential contribution for every coordinate. Writing a product only over the variance factors while leaving an exponential with an unbound coordinate index does not define the intended likelihood.
  • Using \(n-1\) for the maximum-likelihood variance. The estimate is \(S_j/n\). Replacing \(n\) by \(n-1\) changes the estimator and does not maximize this likelihood.
  • Assuming every data set has a finite variance MLE. If any coordinate is constant across the observations, its likelihood increases without bound as its fitted variance approaches zero.
  • Confusing zero covariance with unrestricted dependence. Under a multivariate normal model, diagonal covariance implies independent coordinates. That conclusion depends on normality; zero covariance alone does not generally imply independence.
Key takeaway: With independent multivariate normal observations and a positive diagonal covariance matrix, the likelihood separates by coordinate. When every coordinate has positive centered sum of squares, its mean MLE is the sample mean and its variance MLE is the centered sum of squares divided by \(n\). A constant coordinate prevents a finite maximum.

Check Your Understanding

Use the model and results developed above to answer these questions.

  1. Why does the diagonal Gaussian likelihood split into a product of coordinate-specific factors?
  2. For one coordinate with observations \(2,4,6\), calculate the mean and maximum-likelihood variance estimates.
  3. What happens to the likelihood when a coordinate has zero centered sum of squares and its variance approaches zero?
  4. Explain why the maximum-likelihood variance uses denominator \(n\), rather than \(n-1\).
  5. In a multivariate normal model, what does a diagonal covariance matrix imply about the coordinates within one observation?
Clinical Biostats