Why Covariance Estimation Must Follow the Patterns
When different subjects have different subsets of variables observed, there is no single complete data matrix whose ordinary sample covariance can be used without qualification. A likelihood analysis instead asks what each subject’s observed values imply about the joint model. In a Gaussian model, each distinct observed subset contributes the density of the corresponding marginal Gaussian distribution. The covariance parameters are shared across these contributions, so the resulting score equations generally combine information across patterns rather than reducing to one sample covariance formula.
Assume independent subjects \(X_i\sim N_p(\mu,\Sigma)\), where \(\mu\in\mathbb{R}^p\) and \(\Sigma\) is positive definite. We use the observed-data likelihood under an ignorable missingness mechanism: the missingness mechanism can be omitted from the likelihood for \((\mu,\Sigma)\) under the usual MAR and parameter-distinctness conditions. The focus here is the Gaussian contribution from the observed values.
The likelihood contribution for a subject with pattern \(r\) is the marginal density of \(X_{i,O_r}\), not the density of a completed vector with guessed values inserted. Define \(q_r=|O_r|\) and \(\Sigma_r=\Sigma_{O_rO_r}\). The log-likelihood, up to any omitted missingness-mechanism term, is
Each pattern has its own determinant, inverse, and residual sum of squares. Nevertheless, all the \(\Sigma_r\) are submatrices of one common \(\Sigma\). That shared parameterization is what couples the pattern contributions.
Worked Example: Writing Contributions for Three Patterns
Suppose \(p=3\), with \(\mu=(10,20,30)^\mathsf{T}\), and covariance matrix \(\Sigma=\begin{pmatrix}4&1&0.5\\1&9&2\\0.5&2&16\end{pmatrix}\). There are two subjects observed on variables \(\{1,2\}\), with values \((12,19)\) and \((9,23)\); one subject observed on \(\{1,3\}\), with values \((11,32)\); and two subjects observed only on variable \(2\), with values \(22\) and \(18\).
For the first pattern, the marginal mean is \((10,20)^\mathsf{T}\) and the covariance submatrix is \(\Sigma_{12,12}=\begin{pmatrix}4&1\\1&9\end{pmatrix}\). Its residuals are \((2,-1)^\mathsf{T}\) and \((-1,3)^\mathsf{T}\), so its contribution is \[ -\frac12\left[2(2\log(2\pi)+\log 35) +(2,-1)\Sigma_{12,12}^{-1}(2,-1)^\mathsf{T} +(-1,3)\Sigma_{12,12}^{-1}(-1,3)^\mathsf{T}\right]. \] Here \(|\Sigma_{12,12}|=4(9)-1=35\).
For pattern \(\{1,3\}\), the covariance submatrix is \(\begin{pmatrix}4&0.5\\0.5&16\end{pmatrix}\), whose determinant is \(64-0.25=63.75\). The residual is \((1,2)^\mathsf{T}\), giving a one-subject bivariate marginal contribution using that submatrix and residual.
For pattern \(\{2\}\), the variance is \(\Sigma_{22}=9\), and the residuals are \(2\) and \(-2\). Its contribution is \(-\frac12[2\log(2\pi)+2\log 9+(2^2+(-2)^2)/9]\). This last pattern informs the variance of variable 2, but it does not directly supply a cross-product involving variables 1 or 3.
Covariance and Mean Score Equations
For each pattern define the residual sum matrix \(S_r=\sum_{i\in I_r}(x_{i,O_r}-\mu_{O_r})(x_{i,O_r}-\mu_{O_r})^\mathsf{T}\). The covariance contribution depends on the data through this matrix. The following score formula makes the role of each pattern explicit.
To see the equation in full coordinates, let \(E_r\) be the \(p\times q_r\) matrix that selects coordinates in \(O_r\), so \(\Sigma_r=E_r^\mathsf{T}\Sigma E_r\). Put \(A_r=\Sigma_r^{-1}S_r\Sigma_r^{-1}-n_r\Sigma_r^{-1}\). Since \(d\Sigma_r=E_r^\mathsf{T}(d\Sigma)E_r\), the full-coordinate covariance score equation is
This is an equation in the free entries of a symmetric \(\Sigma\). Equivalently, the diagonal score for entry \(\sigma_{jj}\) is half the \(jj\) entry of the displayed sum, and the score for an off-diagonal parameter \(\sigma_{jk}\), \(j<k\), is the \(jk\) entry. The different factors follow from counting both symmetric positions in a trace.
For a positive-definite matrix \(V\), \(d\log|V|=\operatorname{tr}(V^{-1}dV)\).
For fixed residual vector \(z\), \(d(V^{-1})=-V^{-1}(dV)V^{-1}\), so \(d(z^\mathsf{T}V^{-1}z)=-\operatorname{tr}(V^{-1}zz^\mathsf{T}V^{-1}dV)\).
Summing the quadratic differentials replaces each \(zz^\mathsf{T}\) by \(S_r\), while the determinant term occurs \(n_r\) times.
For completeness, applying those identities to the pattern-\(r\) log-likelihood gives \[ d\ell_r=-\frac12 n_r\operatorname{tr}(\Sigma_r^{-1}d\Sigma_r) +\frac12\sum_{i\in I_r}\operatorname{tr}\!\left[ \Sigma_r^{-1}z_i z_i^\mathsf{T}\Sigma_r^{-1}d\Sigma_r\right], \] where \(z_i=x_{i,O_r}-\mu_{O_r}\). Summing over \(i\) yields the stated formula. Substituting \(d\Sigma_r=E_r^\mathsf{T}(d\Sigma)E_r\) and using \(\operatorname{tr}(AB)=\operatorname{tr}(BA)\) gives the embedded full-coordinate equation. This proves the covariance score result. \(\square\)
The mean score follows by differentiating the residual quadratics with respect to \(\mu\):
In general, the mean and covariance equations must be solved jointly. Substituting a pattern-specific sample mean into each pattern’s covariance calculation does not enforce one common \(\mu\), just as calculating separate covariances does not enforce one common \(\Sigma\).
Worked Example: Evaluating the Covariance Score at a Trial Value
Let \(p=2\) and suppose the mean is known to be zero. Two fully observed residuals are \((1,1)^\mathsf{T}\) and \((-1,1)^\mathsf{T}\). Two additional subjects have only variable 1 observed, with residuals \(1\) and \(-1\). Evaluate the covariance score at \(\Sigma=\begin{pmatrix}2&0.5\\0.5&1\end{pmatrix}\).
For the full pattern, \(n=2\), \(S=\begin{pmatrix}2&0\\0&2\end{pmatrix}\), and \(\Sigma^{-1}=\frac17\begin{pmatrix}4&-2\\-2&8\end{pmatrix}\). Thus \[ \Sigma^{-1}S\Sigma^{-1}-2\Sigma^{-1} =\begin{pmatrix}-16/49&-20/49\\-20/49&24/49\end{pmatrix}. \] For the variable-1-only pattern, \(S_1=2\), \(n_1=2\), and \(\Sigma_{11}=2\). Its univariate coefficient is \(S_1/\Sigma_{11}^2-n_1/\Sigma_{11}=2/4-2/2=-1/2\). Embedding and adding gives the full coefficient matrix \[ B=\begin{pmatrix}-16/49-1/2&-20/49\\-20/49&24/49\end{pmatrix} =\begin{pmatrix}-81/98&-20/49\\-20/49&24/49\end{pmatrix}. \] Since \(d\ell=\frac12\operatorname{tr}(B\,d\Sigma)\), the scores for \(\sigma_{11},\sigma_{22},\sigma_{12}\) are respectively \(-81/196\), \(12/49\), and \(-20/49\). The trial covariance is therefore not stationary. Notice that the univariate pattern changes the score for \(\sigma_{11}\), but contributes nothing directly to the cross-covariance score.
A Solvable Case: Diagonal Covariance
General covariance score equations are nonlinear because each pattern contains a matrix inverse and determinant. A useful check on the patternwise construction is a model where the covariance is constrained to be diagonal. Suppose \(\mu\) is known, and \(\Sigma=\operatorname{diag}(v_1,\ldots,v_p)\) with every \(v_j>0\). Then the observed-data log-likelihood separates by variable, even when patterns contain different subsets.
Indeed, the terms involving \(v_j\) are \[ \ell_j(v_j)=-\frac12\left[m_j\log(2\pi)+m_j\log v_j+\frac{Q_j}{v_j}\right]. \] Differentiating gives \(\ell_j'(v_j)=-m_j/(2v_j)+Q_j/(2v_j^2)\), which vanishes exactly at \(v_j=Q_j/m_j\). For \(v_j<Q_j/m_j\) the derivative is positive, and for \(v_j>Q_j/m_j\) it is negative. Therefore this root is the unique maximum on \(v_j>0\), proving the result. \(\square\)
Worked Example: Estimating Diagonal Variances Across Patterns
Use the known mean \((0,0)^\mathsf{T}\) and a diagonal covariance model. Two subjects are observed on both variables, with values \((1,1)\) and \((-1,1)\). Three further subjects have only variable 1 observed, each with value \(0\), and two further subjects have only variable 2 observed, each with value \(0\).
Variable 1 is observed \(m_1=2+3=5\) times. Its sum of squared residuals is \(Q_1=1^2+(-1)^2+0+0+0=2\), so \(\hat v_1=2/5=0.4\). Variable 2 is observed \(m_2=2+2=4\) times, with \(Q_2=1^2+1^2+0+0=2\), so \(\hat v_2=2/4=0.5\). The fitted covariance matrix is \(\operatorname{diag}(0.4,0.5)\). The denominators differ because the observed counts differ; neither denominator is the total number of subjects.
Numerical Estimation and Common Pitfalls
For an unrestricted covariance matrix, the score equations usually require numerical solution. A practical implementation evaluates every pattern’s marginal covariance submatrix, log determinant, inverse, and residual sum matrix, then adds the embedded score contributions. To keep candidate matrices positive definite, an optimizer can parameterize \(\Sigma=LL^\mathsf{T}\), with \(L\) lower triangular and positive diagonal entries. At a fitted interior solution, the free-parameter score should be near zero, and the observed-data log-likelihood should be checked directly.
A frequent mistake is to estimate each covariance entry using only subjects who have both corresponding variables, then assemble those pairwise estimates into one matrix. Such calculations do not generally solve the likelihood equations: observations of a single variable affect its variance, and that variance appears in inverses and determinants for every pattern containing it. Even pairwise values assembled from sensible samples need not form a positive-definite matrix. The likelihood approach instead estimates one shared positive-definite \(\Sigma\) using all observed marginal contributions.
Another mistake is to treat missing entries as zero or to use a completed data matrix without accounting for how the entries were filled. Neither operation is part of the observed-data likelihood. The pattern-specific density is defined by the actually observed coordinates. If a pattern contains no information about a particular cross-product directly, that does not license inventing a cross-product; the shared covariance structure and the other patterns determine how its parameters enter the likelihood.
Check Your Understanding
Use the patternwise likelihood and score equations to answer these questions.
- For a pattern observing variables \(\{1,3\}\), which entries of \(\mu\) and \(\Sigma\) appear in that subject’s marginal density?
- Why does a pattern observing only variable \(j\) contribute to the score for \(\sigma_{jj}\), but not directly to a score for \(\sigma_{jk}\) when \(k\ne j\)?
- In the known-mean diagonal model, what are \(m_j\) and \(Q_j\), and why is the variance estimate \(Q_j/m_j\) rather than a divisor based on the total sample size?
- Explain why separately calculated pairwise covariance estimates need not satisfy the joint likelihood score equations.
- What does a nonzero covariance score at a positive-definite trial matrix tell you, and what should be checked after numerical optimization?