For prototyping get_sumstats()
function in data object.
Here I allow for presence of missing data. I load all packages to access some private functions.
devtools::load_all("/home/gaow/Documents/GIT/software/susieR")
devtools::load_all("/home/gaow/Documents/GIT/software/mvsusieR")
set.seed(1)
dat = mvsusie_sim1(100,100,5,4,center_scale=F,y_missing=0.5)
names(dat)
resid_Y <- compute_cov_diag(dat$y)
resid_Y_miss <- compute_cov_diag(dat$y_missing)
alpha = 0
Without and with missing data:
d1 = DenseData$new(dat$X, dat$y,center=T,scale=T)
res1 = d1$get_sumstats(diag(resid_Y), cov2cor(resid_Y), alpha)
z1 = res1$bhat/res1$sbhat0
d2 = DenseData$new(dat$X, dat$y_missing,center=T,scale=T)
res2 = d2$get_sumstats(diag(resid_Y_miss), cov2cor(resid_Y_miss), alpha)
z2 = res2$bhat/res2$sbhat0
lm.fit
¶z3 = susieR:::calc_z(dat$X, dat$y,center=T,scale=T)
z4 = susieR:::calc_z(dat$X, dat$y_missing,center=T,scale=T)
plot(z1,z3)
plot(z2,z4)
The are not exactly identical because here residual variance I put in is variance of y
so it's going to be more conservative. Looking at one y
for example and check bhat
agreement:
res = univariate_regression(dat$X,dat$y[,1],center=T,scale=T)
head(res$betahat)
head(res1$bhat[,1])
head(res$sebetahat)
head(res1$sbhat0[,1])
bhat
are identical but not sebhat
. This is understandable. In unit tests I'll compare bhat
.