Calculate Qi (inverse of Q) and log determinant of Q
calc_qi(eval, D_l, X)
eval | vector of eigenvalues from decomposition of relatedness matrix |
---|---|
D_l | vector of length d_size |
X | design matrix |
a list of length two. First entry in the list is a symmetric numeric matrix, Qi, the inverse of the Q matrix. The second entry in the outputted list is the log determinant of the matrix Q for use in likelihood calculations.
as.matrix(readr::read_tsv(system.file("extdata", "mouse100.cXX.txt", package = "gemma2"), col_names = FALSE)[, 1:100]) -> kinship#> #>eigen2(kinship) -> e2_out e2_out$values -> eval e2_out$vectors -> U eigen_proc(V_g = diag(c(1.91352, 0.530827)), V_e = diag(c(0.320028, 0.561589))) -> ep_out calc_qi(eval = eval, D_l = ep_out[[4]], X = t(rep(1, 100)) %*% U)#> [[1]] #> [,1] [,2] #> [1,] 0.01 0.00 #> [2,] 0.00 0.01 #> #> [[2]] #> [1] 9.21034 #>