Returns the lower triangle in triplets. It becomes a sparse matrix from the Matrix package
with Matrix::sparseMatrix(i = a$i, j = a$j, x = a$x, dims = c(a$n, a$n), symmetric = TRUE),
but this package does not depend on Matrix: the matrix is returned in triplets so anyone
can use whatever they prefer.
Arguments
- ped
data.frame with animal, sire and dam
- id
the animal column
- sire
the sire column
- dam
the dam column
- metafounders
labels of unknown-parent groups; a parent with one of these labels needs no line of its own (any OTHER cited-without-line parent is still a declared error). Metafounders enter as virtual base rows of A(Gamma) after Legarra et al. (2015)
- gamma
the base relationship matrix of the metafounders. Either a vector of length
n_metafounders, read as the DIAGONAL, or a full symmetricn_metafounders x n_metafoundersmatrix. The off-diagonalgamma_jkis the ancestral relationship BETWEEN two base populations, which is what a multibreed analysis turns on; it may be NEGATIVE, for bases pulled apart by selection in opposite directions. Admissibility is positive SEMI-definiteness, tested by a spectral decomposition and not by a Cholesky, plus a diagonal below 2 so that a metafounder's offspring keeps a positive Mendelian variance. A SINGULAR gamma is accepted, through the Moore-Penrose pseudo-inverse: that coversgamma = 0, the unknown-parent-group limit, where the pseudo-inverse reproduces the A-inverse of unknown parent groups exactly, and two metafounders standing for one population, whose rows are identical. What is still refused is an INDEFINITE gamma, a negative eigenvalue, which does not generate a covariance matrix at all
References
Henderson, C.R. (1976). A simple method for computing the inverse of a numerator relationship matrix used in prediction of breeding values. Biometrics 32:69-83.
Quaas, R.L. (1976). Computing the diagonal elements and inverse of a large numerator relationship matrix. Biometrics 32:949-953.