Learn R Programming

gaston (version 1.2)

GRM: Genetic Relationship Matrix

Description

Compute the Genetic Relationship Matrix

Usage

GRM(x, chunk = 1L)

Arguments

Value

The GRM is a symmetric square matrix of dimension equal to the number of individuals. Each entry can be interpreted as an estimated kinship coefficient between individuals, although some authors might disagree.

Details

The Genetic Relationship Matrix (GRM) is computed by the formula ${1\over q}XX'$, with $X$ the standardized genotype matrix and $q$ the number of SNPs (ncol(x)).

Note that x needs to be standardized before this computation, either by standardize(x) <- "p" or by standardize(x) <- "mu_sigma".

See Also

lmm.aireml, lmm.diago, standardize, bed.loadings

Examples

Run this code
# load chr2 data set (~10k SNPs in low LD)
x <- read.bed.matrix( system.file("extdata", "chr2.bed", package="gaston") )

# Compute Genetic Relationship Matrix
standardize(x) <- 'p'
K <- GRM(x)
dim(K)

Run the code above in your browser using DataLab