Learn R Programming

plmmr (version 4.3.0)

relatedness_mat: Calculate a relatedness matrix

Description

Given a matrix of genotypes, this function estimates the genetic relatedness matrix (GRM, also known as the RRM, see Hayes et al. 2009, tools:::Rd_expr_doi("10.1017/S0016672308009981")) among the subjects: \(\frac{1}{p}(XX^T)\), where X is standardized.

Usage

relatedness_mat(X, std = TRUE)

Value

An n x n numeric matrix capturing the genomic relatedness of the samples represented in X. In our notation, we call this matrix K for 'kinship'; this is also known as the GRM or RRM.

Arguments

X

An n x p numeric matrix of genotypes (from fully-imputed data). Can be a filebacked big.matrix object. Note: This matrix should not include non-genetic features.

std

Logical: should X be standardized? If you set this to FALSE, you should have a good reason for doing so, as standardization is a best practice.

Examples

Run this code
RRM <- relatedness_mat(X = admix$X)
RRM[1:5, 1:5]

Run the code above in your browser using DataLab