makeAinv: Makes inverted A matrix for a pedigree

View source: R/drivers.r

makeAinvR Documentation

Makes inverted A matrix for a pedigree

Description

Makes inverted A matrix for a pedigree and stores it in a file called Ainv.txt.

Usage

makeAinv(ped)

Arguments

ped

data.frame with three columns: id,id parent1,id parent2

Value

Logical.

Examples

id <- 1:6
dam <- c(0,0,1,1,4,4)
sire <- c(0,0,2,2,3,5)
ped <- data.frame(id,dam,sire)
makeAinv(ped)
Ai <- read.table('Ainv.txt')
nInd <- nrow(ped)
Ainv <- matrix(0,nrow = nInd,ncol = nInd)
Ainv[as.matrix(Ai[,1:2])] <- Ai[,3]
dd <- diag(Ainv)
Ainv <- Ainv + t(Ainv)
diag(Ainv) <- dd

if(file.exists("Ainv.txt"))
file.remove("Ainv.txt")

pedigree documentation built on Aug. 14, 2022, 1:06 a.m.