Dmat: Mendelian sampling variance

View source: R/pedigree.R

DmatR Documentation

Mendelian sampling variance

Description

Determine the diagonal factor in the decomposition of the relationship matrix A as TDT' where T is unit lower triangular.

Usage

Dmat(ped, vector = TRUE)

getD(ped, vector = TRUE)

getDInv(ped, vector = TRUE)

Arguments

ped

pedigree

vector

logical, return a vector or sparse matrix

Value

a numeric vector

Functions

  • getD(): Mendelian sampling variance

  • getDInv(): Mendelian sampling precision (= 1 / variance)

Examples

ped <- pedigree(sire = c(NA, NA, 1,  1, 4, 5),
                dam =  c(NA, NA, 2, NA, 3, 2),
                label = 1:6)
(D <- getD(ped))
(DInv <- getDInv(ped))

# Test for correctness
DExp <- c(1.00, 1.00, 0.50, 0.75, 0.50, 0.46875)
stopifnot(!any(abs(D - DExp) > .Machine$double.eps))

DInvExp <- 1 / DExp
stopifnot(!any(abs(DInv - DInvExp) > .Machine$double.eps))

pedigreeTools documentation built on Oct. 12, 2024, 9:07 a.m.