Calculate Vg and Ve from d-variate phenotype and kinship

calc_covs(
  pheno,
  kinship,
  X1pre = rep(1, nrow(kinship)),
  max_iter = 1e+06,
  max_prec = 1/1e+08,
  covariates = NULL
)

Arguments

pheno

n by d matrix of phenotypes

kinship

a kinship matrix, n by n

X1pre

n by c design matrix. c = 1 to ignore genotypes

max_iter

maximum number of EM iterations

max_prec

maximum precision for stepwise increments in EM algorithm

covariates

a n by n.cov matrix of numeric covariates

Value

a list with 2 named components, Vg and Ve. Each is a d by d covariance matrix.

Examples

calc_covs(pheno = matrix(data = rnorm(100), nrow = 50, ncol = 2), kinship = diag(50))
#> $Vg #> [,1] [,2] #> [1,] 0.47241130 0.03439352 #> [2,] 0.03439352 0.52690628 #> #> $Ve #> [,1] [,2] #> [1,] 0.47241130 0.03439352 #> [2,] 0.03439352 0.52690628 #>