This is to verify that the mvsusieR implementation is correct for the truthly multivariate computations. Previously I have only compared it for the degenerated case where the prior matrix is 1 by 1.
set.seed(1)
n = 1000
p = 1000
X = matrix(rnorm(n*p),nrow=n,ncol=p)
beta1 = beta2 = rep(0,p)
beta1[1:4] = runif(4)
beta2[1:4] = runif(4)
y1 = X %*% beta1 + rnorm(n)
y2 = X %*% beta2 + rnorm(n)
beta1[1:4]
beta2[1:4]
m1 = susieR::susie(X,y1,residual_variance = var(y1), estimate_residual_variance=F, scaled_prior_variance = 0.2, L=10)
bhat1 = coef(m1)
m2 = susieR::susie(X,y2,residual_variance = var(y2), estimate_residual_variance=F, scaled_prior_variance = 0.2, L=10)
bhat2 = coef(m2)
bhat1[2:5]
bhat2[2:5]
prior_var = diag(0.2 * c(var(y1), var(y2)))
residual_var = diag(c(var(y1), var(y2)))
y = cbind(y1,y2)
data = mvsusieR:::DenseData$new(X,y)
prior_covar = mvsusieR:::MashInitializer$new(list(prior_var), 1, alpha=0)
m = mvsusieR::mvsusie(X, y, L=10, prior_variance=prior_covar)
dim(m$coef)
mvsusieR::mvsusie_get_cs_lfsr(m)
pip_cond = mvsusieR:::mvsusie_get_pip_per_condition(m, prior_covar)
dim(pip_cond)
head(pip_cond)