For \(y=X\beta+Zu+e\), with \(\operatorname{Var}(u)=G\) and
\(\operatorname{Var}(e)=R\), the unscaled Henderson matrix is
$$C_0=\left[\begin{array}{cc}
X'R^{-1}X & X'R^{-1}Z \\
Z'R^{-1}X & Z'R^{-1}Z+G^{-1}
\end{array}\right].$$
Its random-effect inverse block is
\(Q=(C_0^{-1})_{uu}=\operatorname{Var}(u-\hat u)\). Consequently,
$$\operatorname{Var}(\hat u)=G-Q.$$
For known covariance parameters this identity is exact. At estimated
parameters the result is a plug-in covariance, omitting covariance-parameter
estimation uncertainty. The same identity is used for ML and REML fits.
The implementation does not construct or invert the observation covariance
\(V=ZGZ'+R\). Error covariance is computed by solving the stored Henderson
system and multiplying by Cscale to recover the original response
scale. For each independent random term,
\(G_k=\Sigma_k\otimes A_k\), where \(\Sigma_k\) is the fitted
covariance-coordinate matrix and \(A_k\) the relationship covariance.
Products with \(A_k\) are evaluated by solving its retained sparse
precision, not by explicitly forming its inverse or the full joint \(G\).
mode=1 processes identity contrasts in batches of at most 128 rows,
so neither a full coefficient inverse nor a full random-effect covariance
matrix is stored. It requires solves for all requested effect diagonals and
can be expensive for large models. mode=2 requires quadratic storage
in the number of random effects. Although independent terms have zero prior
cross-covariance, their BLUPs can have nonzero sampling cross-covariance; the
joint VarU includes these cross-term entries.
Rotation and factor-score augmentation are mapped to the public
uList coordinates before computing error covariance. New fits retain
randomPrecision in original level order, so external Gu
objects are not needed after fitting. Older ordinary fits attempt to rebuild
relationship precisions from saved model inputs, requiring the original
formula objects; dimension checks cannot detect all changes to those objects.
Older rotated or augmented fits must be refitted. No clipping is performed:
small negative variances from numerical cancellation remain visible.
Existing Ci and uPevList are left unchanged. The variance here
is not the empirical variance across BLUP values and is not a posterior
variance of \(u\). It is the repeated-sampling covariance of \(\hat u\).