Check for agreement of different regression methods in VEM updates.
library(mvsusieR)
set.seed(2)
attach(mvsusie_sim1(r=1))
data = mvsusieR:::DenseData$new(X,y)
head(data$XtY)
head(data$XtR)
prior_var = 0.2 * as.numeric(var(y))
residual_var = as.numeric(var(y))
m1 = mvsusieR:::SingleEffectModel(mvsusieR:::BayesianSimpleRegression)$new(ncol(X), residual_var, prior_var)
prior_covar = mvsusieR:::MashInitializer$new(list(0.2 * cov(y)), 1, alpha=0)
residual_covar = cov(y)
m2 = mvsusieR:::SingleEffectModel(mvsusieR:::MashRegression)$new(ncol(X), residual_covar, prior_covar)
pred01 = m1$predict(data)
m1$fit(data)
pred1 = m1$predict(data)
pred02 = m2$predict(data)
m2$fit(data)
pred2 = m2$predict(data)
head(pred1)
head(pred2)
head(pred01)
head(pred02)
head(m1$pip)
head(m2$pip)
head(m1$posterior_b1 / m1$pip)
head(m2$posterior_b1 / m2$pip)
m1$lbf
m2$lbf
data$add_to_fitted(pred1)
data$compute_residual()
head(data$XtY)
head(data$XtR)
m1$fit(data)
pred1 = m1$predict(data)
m2$fit(data)
pred2 = m2$predict(data)
head(pred1)
head(pred2)
head(m1$pip)
head(m2$pip)
head(m1$posterior_b1)
head(m2$posterior_b1)
m1$lbf
m2$lbf
data$add_to_fitted(pred1)
data$compute_residual()
head(data$XtR)
m1$fit(data)
pred1 = m1$predict(data)
m2$fit(data)
pred2 = m2$predict(data)
head(m1$posterior_b1)
head(m2$posterior_b1)
m1$lbf
m2$lbf
L = 10
residual_var = as.numeric(var(y))
scaled_prior_var = V[1,1] / residual_var
A = susie(X,y,L=L,prior_variance=scaled_prior_var,
compute_objective=FALSE)
residual_cov = cov(y)
m_init = mvsusieR:::MashInitializer$new(list(V), 1, alpha = 0)
B = susie(X,y,L=L,prior_variance=m_init,compute_objective=FALSE)
max(abs(A$lbf - B$lbf))