relatedness_mat {plmmr}R Documentation

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, doi:10.1017/S0016672308009981) among the subjects: XX'/p, where X is standardized.

Usage

relatedness_mat(X, std = TRUE, fbm = FALSE, ns = NULL, ...)

Arguments

X

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

std

Logical: should X be standardized? If you set this to FALSE (which can only be done if data are stored in memory), you should have a good reason for doing so, as standardization is a best practice.

fbm

Logical: is X stored as an FBM? Defaults to FALSE

ns

Optional vector of values indicating the indices of nonsingular features

...

Other optional arguments to bigstatsr::bigapply() (like ncores = ...)

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.

Examples

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

[Package plmmr version 4.1.0 Index]