Learn R Programming

statgenGWAS (version 1.0.7)

kinship: Functions for calculating kinship matrices

Description

A collection of functions for calculating kinship matrices using different algorithms. The following algorithms are included: astle (Astle and Balding, 2009), Identity By State (IBS) and VanRaden (VanRaden, 2008) for marker matrices. For method identity an identity kinship matrix is returned.

Usage

kinship(
  X,
  method = c("astle", "IBS", "vanRaden", "identity"),
  denominator = NULL
)

Arguments

X

An n x m marker matrix with genotypes in the rows (n) and markers in the columns (m).

method

The method used for computing the kinship matrix.

denominator

A numerical value. See details.

Value

An n x n kinship matrix.

Marker matrices

In all algorithms the input matrix X is first cleaned, i.e. markers with a variance of 0 are excluded from the calculation of the kinship matrix. Then some form of scaling is done which differs per algorithm. This gives a scaled matrix Z. The matrix \(ZZ^t / denominator\) is returned. By default the denominator is equal to the number of columns in Z for astle and IBS and \(2 * p * (1-p)\) where \(p = colSums(X) / (2 * nrow(X))\) for vanRaden. This denominator can be overwritten by the user, e.g. when computing kinship matrices by splitting X in smaller matrices and then adding the results together in the end.

References

Astle, William, and David J. Balding. 2009. <U+201C>Population Structure and Cryptic Relatedness in Genetic Association Studies.<U+201D> Statistical Science 24 (4): 451<U+2013>71. 10.1214/09-sts307.

VanRaden P.M. (2008) Efficient methods to compute genomic predictions. Journal of Dairy Science 91 (11): 4414<U+2013>23. 10.3168/jds.2007-0980.

Examples

Run this code
# NOT RUN {
## Create example matrix.
M <- matrix(c(1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1), nrow = 3)

## Compute kinship matrices using different methods.
kinship(M, method = "astle")
kinship(M, method = "IBS")
kinship(M, method = "vanRaden")

## Compute kinship matrix using astle and balding method with denominator 2.
kinship(M, method = "astle", denominator = 2)

# }

Run the code above in your browser using DataLab