Calculate XHiY

calc_XHiY(eval, D_l, X, UltVehiY)

Arguments

eval

vector of eigenvalues from the decomposition of the relatedness matrix

D_l

vector of length d_size

X

design matrix

UltVehiY

a matrix

Value

numeric vector

Examples

readr::read_tsv(system.file("extdata", "mouse100.pheno.txt", package = "gemma2"), col_names = FALSE) -> pheno
#> #> ── Column specification ──────────────────────────────────────────────────────── #> cols( #> X1 = col_double(), #> X2 = col_double(), #> X3 = col_double(), #> X4 = col_double(), #> X5 = col_double(), #> X6 = col_double() #> )
phe16 <- as.matrix(pheno[, c(1, 6)]) as.matrix(readr::read_tsv(system.file("extdata", "mouse100.cXX.txt", package = "gemma2"), col_names = FALSE)[, 1:100]) -> kinship
#> #> ── Column specification ──────────────────────────────────────────────────────── #> cols( #> .default = col_double(), #> X101 = col_logical() #> ) #> Use `spec()` for the full column specifications.
eigen2(kinship) -> eout eout$values -> eval eout$vectors -> U UltVehi <- matrix(c(0, -1.76769, -1.334414, 0), nrow = 2, byrow = FALSE) # from output of eigen_proc() calc_XHiY(eval = eval, D_l = c(0.9452233, 5.9792268), X = rep(1, 100) %*% U, UltVehiY = UltVehi %*% t(phe16) %*% U )
#> [1] -71.34203 -82.44818