Matrices provided from fitting empirical Bayes normal means problem (EBNM) using exchangable standard effects model ($\beta/s | s \sim g(\cdot)$) must be scaled by residual variance and sample size in msSuSiE analysis, when the variables matrix $X$ is standardized.
Load data-set:
library(susieR)
data("N3finemapping")
attach(N3finemapping)
get_sumstat = function(X,Y, standardize=F) {
if (standardize) X = scale(X)
ss1 = susieR:::univariate_regression(X, Y[,1])
ss2 = susieR:::univariate_regression(X, Y[,2])
bhat = cbind(ss1$betahat, ss2$betahat)
sbhat = cbind(ss1$sebetahat, ss2$sebetahat)
return(list(b=bhat,s=sbhat))
}
First, we obtain effect size and their standard errors from univariate analysis,
out = get_sumstat(X,Y)
The prior for effect size, assuming it is obtained by the EBNM, should be at the scale of:
U_EE = cov(out$b)
U_EE
However, we often perform EBNM under exchangable standardized effects model, resulting in matrices at the scale of:
U_EZ = cov(out$b/out$s)
U_EZ
get_sigma = function(Y) {
sigma = sapply(1:ncol(Y), function(i) sd(Y[,i], na.rm=T))
N = sapply(1:ncol(Y), function(i) length(which(!is.na(Y[,1]))))
sigma/sqrt(N)
}
sigma = get_sigma(Y)
We cannot convert U_EZ
back to U_EE
for use with mvSuSiE analysis because is no obvious connection between U_EE
and U_EZ
t(U_EZ * sigma) * sigma
When $X$ is standardized,
out.s = get_sumstat(X,Y,T)
U_EE = cov(out.s$b)
U_EE
U_EZ = cov(out.s$b/out.s$s)
U_EZ
We can recover U_EE
from U_EZ
via:
t(U_EZ * sigma) * sigma
Notice that here U_EZ
remains the same regardless of $X$ being standardized beforehand.
Our EBNM based prior workflow should be:
U_EZ
from external data using EBNM. It does not matter whether or not the external data is a result of scaled $X$ or not because we use exchangable standardized effect model anywaysU_EE
from U_EZ
as outlined above. The U_EZ
thus generated will match the scale of the effect size for standardized $X$