Simulates residual multivariate Gaussian response data from a pedigree where the additive genetic, dominance genetic, and shared environmental effects are taken into account.

rmvtnorm.pedigree(n = 1, pedigree, h2 = 0, c2 = 0, d2 = 0)

Arguments

n

numeric. The number of simulations to generate

pedigree

a pedigree object

h2

numeric. The heritability

c2

numeric. The environmentability

d2

numeric. The dominance deviance effect

Value

Returns a matrix with the simulated values with n columns (one for each simulation) and each row matches the corresponding individual from the pedigree

Details

The three parameters should have a sum: h2+c2+d2 that is less than 1. The total variance is set to 1, and the mean is zero.

See also

pedigree, kinship,

Author

Claus Ekstrom claus@rprimer.dk

Examples


library(kinship2)
library(mvtnorm)
mydata <- data.frame(id=1:5,
                     dadid=c(NA, NA, 1, 1, 1),
                     momid=c(NA, NA, 2, 2, 2),
                     sex=c("male", "female", "male", "male", "male"),
                     famid=c(1,1,1,1,1))
relation <- data.frame(id1=c(3), id2=c(4), famid=c(1), code=c(1))
ped <- pedigree(id=mydata$id, dadid=mydata$dadid, momid=mydata$momid,
                sex=mydata$sex, relation=relation)
rmvtnorm.pedigree(2, ped, h2=.25)
#>             [,1]       [,2]
#> [1,]  0.15381995 -0.6341060
#> [2,] -0.84247748  0.1526029
#> [3,]  0.78737464 -1.0571320
#> [4,]  0.41103681  2.0702981
#> [5,]  0.07712145 -0.1924347