R/rcpp_calc_Bhat.R
rcpp_calc_Bhat2.Rd
Estimate allele effects matrix, B hat, with Rcpp functions
rcpp_calc_Bhat2(X, Y, Sigma_inv)
X | dn by df block-diagonal design matrix that incorporates genetic info for two markers. Note that we can use the same marker data twice. |
---|---|
Y | dn by 1 matrix, ie, a column vector, of d phenotypes' measurements |
Sigma_inv | dn by dn inverse covariance matrix, often composed as inverse of \(K \otimes V_g + I_n \otimes V_g\) |
a df by 1 matrix of GLS-estimated allele effects
X1 <- as.matrix(rbinom(n = 100, size = 1, prob = 1 / 2)) X <- gemma2::stagger_mats(X1, X1) Sigma_inv <- diag(200) Y <- runif(200) rcpp_calc_Bhat2(X = X, Y = Y, Sigma_inv = Sigma_inv)#> [,1] #> [1,] 0.4113715 #> [2,] 0.4518089