Algorithmic reference: from a mixed model to accepted inference
Advanced notes: contents · Abbreviations
1 Mathematical scope
Consider \(y=X\beta+Zu+e\), with \(u\sim N(0,K)\) and \(e\sim N(0,R)\) independent. This reference derives computational identities for a Gaussian model with positive-definite \(K,R\) and full-column-rank \(X\), unless a different case is explicitly stated. Covariance parameters are fixed within a coefficient solve. The statistical interpretation is developed in Chapters 1–3 (Henderson, 1975; Robinson, 1991).
A complete algorithm must preserve observation identities, effect domains, trait order, covariance scale and prediction targets. A computational ordering is a permutation of the scientific problem, not a redefinition of animal IDs. The equations below are independent of a particular file format or application programming interface (API).
2 What must an implementation be able to apply?
Dense \(X\) and \(Z\) notation is convenient for derivation, but does not require global incidence matrices in memory. An implementation can provide forward and transpose incidence actions, residual precision actions and random-effect precision actions.
For \(v=(v_\beta^\top,v_u^\top)^\top\), set \(h=Xv_\beta+Zv_u\) and \(w=R^{-1}h\). The mixed-equation operator is
\[ Cv=\begin{bmatrix}X^\top w\\Z^\top w+K^{-1}v_u\end{bmatrix}, \qquad b=\begin{bmatrix}X^\top R^{-1}y\\Z^\top R^{-1}y\end{bmatrix}. \]
This defines a matrix-free product without changing the target. Independent residual blocks can be factored separately. Multiple traits require the correct within-block covariance action; treating their residual precisions as unrelated scalars changes the model.
For a genomic component \(K_a=\tau^2WW^\top\), the covariance action on a vector or batch \(v\) is \(K_av=\tau^2W(W^\top v)\). An animal-covariance operator is not automatically an efficient animal-precision operator: applying \(K_a^{-1}\) can itself require a solve or a different latent representation. Packed marker products save storage and decoding work, not this distinction.
3 Block elimination and the marginal model
Define
\[ S_u=K^{-1}+Z^\top R^{-1}Z. \]
The random equations imply
\[ \hat u=S_u^{-1}Z^\top R^{-1}(y-X\hat\beta). \]
Substitution into the fixed equations gives
\[ X^\top V^{-1}X\hat\beta=X^\top V^{-1}y, \]
because
\[ V^{-1}=R^{-1}-R^{-1}ZS_u^{-1}Z^\top R^{-1}. \]
Conversely, the marginal solution reconstructs the mixed-equation solution. This establishes an exact check between formulations. It does not say to form \(S_u^{-1}\) or \(V^{-1}\) explicitly: retained factors and linear solves implement the inverse actions (Saad, 2003; Sorensen and Gianola, 2002).
3.1 Singular components and constraints
If a component covariance is positive semidefinite, it can sometimes be represented as \(u=Bv\) with a full-column-rank basis and a positive-definite latent covariance. The observation incidence becomes \(ZB\). Zero-variance directions must be handled consistently in prediction and uncertainty.
A redundant fixed-effect design needs an estimable basis or explicit constraints. Adding numerical jitter to avoid either issue is not generally equivalent to the original model. Determinants and likelihood comparisons also need the correct measure and normalization when rank or parameterization changes. The positive-interior identities here must not be applied unchanged across an arbitrary rank-changing boundary (Self and Liang, 1987).
4 Pedigree elimination and single-step representations
For \(Q=A^{-1}\) partitioned into non-genotyped (\(n\)) and genotyped (\(g\)) animals,
\[ A_{gg}^{-1}=Q_{gg}-Q_{gn}Q_{nn}^{-1}Q_{ng}. \]
To apply the right-hand side to \(v\), compute \(t=Q_{ng}v\), solve \(Q_{nn}z=t\), then return \(Q_{gg}v-Q_{gn}z\). This is an exact marginal precision action using a conditional pedigree factor. Selecting \(Q_{gg}\) alone gives a different quantity (Henderson, 1976; Legarra et al., 2014).
A single-step formulation may combine this action with marker products and additional pedigree terms. A reconstruction map must recover animal genetic values on the same scale and domain as the original animal-effect model. Moments of adjusted/blended relationships, innovation variances and covariance cross terms belong to that equivalence proof.
When eliminating a block of the coefficient system, the general identity is
\[ \begin{bmatrix}A&B\\B^\top&D\end{bmatrix} \begin{bmatrix}x\\z\end{bmatrix} =\begin{bmatrix}f\\g\end{bmatrix} \quad\Longrightarrow\quad (A-BD^{-1}B^\top)x=f-BD^{-1}g, \]
followed by \(z=D^{-1}(g-B^\top x)\). This explains why a smaller system can still incur substantial repeated solve work. Fewer unknowns do not imply fewer floating-point operations or lower memory traffic.
5 Direct and iterative coefficient solves
Sparse direct methods separate ordering/symbolic analysis, numerical factorization and triangular solves. A retained factor can serve multiple prediction, derivative or uncertainty right-hand sides (RHS). Covariance changes can preserve the symbolic pattern while invalidating the numerical factor (Chen et al., 2008).
For a symmetric positive definite (SPD) system and a fixed SPD preconditioner \(M\), preconditioned conjugate gradient (PCG) starts with \(r_0=b-Cx_0\), \(z_0=M^{-1}r_0\), \(p_0=z_0\). Its recurrence includes
\[ \alpha_k=\frac{r_k^\top z_k}{p_k^\top Cp_k},\quad x_{k+1}=x_k+\alpha_kp_k,\quad r_{k+1}=r_k-\alpha_kCp_k, \]
\[ z_{k+1}=M^{-1}r_{k+1},\quad \beta_k=\frac{r_{k+1}^\top z_{k+1}}{r_k^\top z_k},\quad p_{k+1}=z_{k+1}+\beta_kp_k. \]
The denominator and inner products assume the required definiteness. A changing or nonlinear preconditioner, indefinite target or inconsistent inner solve needs an algorithm whose assumptions cover that case; ordinary PCG’s guarantees do not transfer automatically (Saad, 2003).
Scaling also matters. If \(M=LL^\top\), the symmetric transformed system is \(L^{-1}CL^{-\top}v=L^{-1}b\), with \(x=L^{-\top}v\). This changes conditioning, not the target solution in exact arithmetic. A model ridge changes \(C\) itself.
6 Residual reconstruction and refinement
Roundoff can make a recursively updated residual differ from \(b-C\hat x\). After reconstructing the original coefficients, recompute the original residual using the declared original operator. Report the precise absolute, relative or backward-error rule used for acceptance.
The identity \(x-\hat x=C^{-1}(b-C\hat x)\) explains why conditioning matters. A small residual is not a dimension-free guarantee on every coefficient or contrast. Conversely, comparing residual norms across differently scaled formulations without reconstructing the same target is not meaningful (Higham, 2002).
Iterative refinement solves a correction equation \(C\delta=r\) and updates \(\hat x\leftarrow\hat x+\delta\). Its effectiveness depends on residual calculation, solve precision and conditioning. Backend refinement steps, explicit correction solves and outer PCG iterations are separate counters. Refinement policy should be evaluated with the same final acceptance rule; reducing corrections is beneficial only if complete accepted work decreases.
7 REML from retained algebra
Set \(P=V^{-1}-V^{-1}X(X^\top V^{-1}X)^{-1}X^\top V^{-1}\) and \(r_y=y-X\hat\beta-Z\hat u\). The minimized joint quadratic is
\[ y^\top Py=r_y^\top R^{-1}r_y+\hat u^\top K^{-1}\hat u. \]
The determinant lemma and block elimination give
\[ |V|=|R||K||S_u|,\qquad |C|=|S_u||X^\top V^{-1}X|. \]
Therefore, for this fixed-rank positive-interior representation,
\[ \log|V|+\log|X^\top V^{-1}X| =\log|R|+\log|K|+\log|C|. \]
This provides an independent likelihood identity and shows why covariance normalization and determinant accounting are essential. A coefficient solution alone is insufficient to evaluate restricted maximum likelihood (REML) (Johnson and Thompson, 1995; Patterson and Thompson, 1971).
For \(V_i=\partial V/\partial\theta_i\) and fixed \(X\), differentiation gives \(\partial P/\partial\theta_i=-PV_iP\). Consequently,
\[ s_i=\tfrac12\{y^\top PV_iPy-\operatorname{tr}(PV_i)\},\quad \mathcal I_{ij}=\tfrac12\operatorname{tr}(PV_iPV_j). \]
When \(V\) is linear in the current covariance parameters, average information has the familiar form \(\mathcal A_{ij}=\tfrac12y^\top PV_iPV_jPy\). This reuses derivative actions and solves instead of finite-differencing a complete optimizer (Gilmour et al., 1995; Johnson and Thompson, 1995). Nonlinear parameterizations require consistent chain rules and the appropriate curvature treatment.
An optimizer also requires admissible trial covariances, a step policy, objective/score criteria and boundary handling. An accepted inner solve is not an accepted outer estimation result.
8 Trace approximation and solve error
For probes with \(E(zz^\top)=I\), \(E(z^\top Bz)=\operatorname{tr}(B)\). The sample average is a trace estimator (Hutchinson, 1989). If \(B\) is implicit, each probe can require one or more coefficient solves. Count these RHS, not only the number of probes. Probability bounds established for symmetric positive semidefinite (PSD) matrices have specific assumptions (Avron and Toledo, 2011).
Finite probe error and solve error are different. Reusing probe banks can reduce noise in differences between nearby parameter evaluations, while creating correlated estimation errors. Precision assessment must respect that dependence. Fixed random seeds provide reproducibility, not proof of accuracy or unbiasedness with inexact solves.
Compare approximate scores with deterministic references on tractable problems; then assess optimization and reported uncertainty at representative scale. The Monte Carlo single-step REML literature illustrates the distinction between retaining a statistical target and approximating inverse-related work (Bermann et al., 2025).
9 Target uncertainty without a full inverse
Let \(L\) collect target coefficient vectors, so that \(L^\top x\) contains the requested fixed/random linear functions. Solve
\[ CU=L,\qquad \operatorname{MSE}(L^\top\hat x-L^\top x)=L^\top U. \]
There is one RHS per target column before any valid batching or structural reduction. This includes fixed/random cross-covariances. Inverting only the random-only coefficient block generally does not give the complete-model prediction error covariance (Robinson, 1991).
Selected inverse methods can reuse factor structure to obtain particular entries, while selected solves obtain requested target systems directly. Neither observation means that arbitrary full inverse output is cheap. A randomized uncertainty estimator introduces a separate precision problem. All these plug-in calculations still condition on covariance parameters; additional covariance-estimation uncertainty is another inferential layer (Kackar and Harville, 1984).
10 Bayesian computation is a different outer problem
With known covariances and a flat prior on identifiable fixed effects, the Gaussian posterior precision is \(C\). If \(C=LL^\top\), a posterior draw can be written \(x^{(s)}=\hat x+L^{-\top}z^{(s)}\) with \(z^{(s)}\sim N(0,I)\). This gives covariance \(C^{-1}\). Solving only for \(\hat x\) returns a posterior mean in this special case, not a draw or a general Bayesian analysis.
With unknown covariance parameters or mixture allocations, conditional coefficient updates form only part of a joint sampler. Hyperparameter, allocation and residual updates must target the same posterior. Integrating over those states can produce nonlinear prediction and additional uncertainty (Habier et al., 2011; Sorensen and Gianola, 2002).
Approximate Gaussian sampling, Markov chain Monte Carlo (MCMC) and variational optimization have different error mechanisms. A linear residual gate does not certify sampler mixing or the fidelity of a variational family. Their computational assessment must include the relevant posterior targets, Monte Carlo or optimization diagnostics, and comparison with tractable independent distributions.
11 Algorithm description and acceptance record
An assessable algorithm description specifies its target equations, representation and reconstruction, admissible parameter domain, outer/inner iteration rules, stopping tests and approximation controls. It reports factorizations, operator applications, solve RHS, correction work and resource limits separately.
Its evidence should demonstrate invariance under equivalent formulations and permutations, derivative and likelihood agreement where applicable, and correct behavior when a requested acceptance criterion cannot be met. The qualification framework describes the distinct roles of algebraic, inferential and performance evidence.