The function previously had an internal call to the kindepth function in
order to provide the parameter pdepth (the generation number). This version
requires the generation number to be calculated elsewhere and passed into
the function.
character vector or NA for the IDs of the sires for the set
of animals.
mother.id
character vector or NA for the IDs of the dams for the set
of animals.
pdepth
integer vector indicating the generation number for each
animal.
sparse
logical flag. If TRUE, Matrix::Diagnol() is
used to make a unit diagonal matrix. If FALSE, base::diag() is
used to make a unit square matrix.
Author
Terry M. Therneau, Mayo Clinic (mayo.edu), original version
All of the code on the original S-Plus kinship function (originally
hosted on Terry Therneau's Mayo Clinic software page, offline since at
least 2019) was stated to be released under the GNU General Public
License (version 2 or later).
The R version became the kinship2 package available on CRAN:
as modified by M Raboin, 2014-09-08 14:44:26
Details
The rows (cols) of founders are just 0.5 * identity matrix, no further
processing is needed for them.
Parents must be processed before their children, and then a child's
kinship is just a sum of the kinship's for his or her parents.
The code for the kinship function was written by Terry Therneau
at the Mayo clinic and taken from his website. This function is part of a
package written in S (and later ported to R) for calculating kinship and
other statistics.