Computes the dense numerator-relationship matrix \(\mathbf A\)
from a 3-column pedigree (id, sire, dam) using Henderson's
(1976) recursive formula:
Arguments
- pedigree
A data frame with one row per individual and columns identifying the individual, sire, and dam. Column names are resolved BY NAME (MCMCglmm-style) using these synonyms:
Individual ID column:
idoranimal.Sire (father) column:
sireorfather.Dam (mother) column:
damormother.
If none of the named synonyms is present, the function falls back to positional access – column 1 = id, column 2 = sire, column 3 = dam – with a soft note. Unknown parents encoded as
NAor0(both treated as missing).
Details
\(A_{ii} = 1 + F_i\), where \(F_i\) is the inbreeding coefficient of individual \(i\).
\(A_{ij} = \tfrac{1}{2}(A_{i,\text{sire}(j)} + A_{i,\text{dam}(j)})\) for \(j\) younger than \(i\) (pedigree is sorted oldest first).
Founder individuals (both parents unknown) are assumed unrelated and non-inbred: \(A_{founder, founder} = 1\).
Users typically don't call pedigree_to_A() directly – pass
pedigree = ped to an animal_scalar() / animal_latent() /
animal_indep() / animal_dep() keyword in
the formula, and the keyword's parser handles the conversion
internally. This function is exported as a public helper for users
who want the matrix for their own diagnostics (e.g. inspection of
inbreeding coefficients or pre-computation for repeated fits).
For very large pedigrees (\(n > 5000\)) the cubic-time cost of
constructing a dense \(\mathbf A\) can become noticeable. When a sparse
precision is available, pass it directly with Ainv =; for comparison
against established implementations, see nadiv::makeAinv().
See also
animal_scalar() and siblings.
