R/mvsusie.R
mvsusie_rss.Rd
SUm of Single Effect (SuSiE) Regression using Summary Statistics Z and R
mvsusie_rss( Z, R, L = 10, prior_variance = 50, residual_variance = NULL, prior_weights = NULL, estimate_prior_variance = TRUE, estimate_prior_method = "EM", check_null_threshold = 0, prior_tol = 1e-09, compute_objective = TRUE, precompute_covariances = FALSE, s_init = NULL, coverage = 0.95, min_abs_corr = 0.5, n_thread = 1, max_iter = 100, tol = 0.001, verbosity = 2, track_fit = FALSE )
Z | a J by R matrix of z scores |
---|---|
R | a J by J LD matrix |
L | maximum number of non-zero effects |
prior_variance | Can be 1) a vector of length L, or a scalar, for scaled prior variance when Y is univariate (equivalent to `susieR::susie`); 2) a matrix for simple Multivariate regression or 3) a MASH fit that contains an array of prior covariance matrices and their weights |
residual_variance | the residual variance (defaults to 1) |
prior_weights | a p vector of prior probability that each element is non-zero |
estimate_prior_variance | indicates whether to estimate prior (currently only works for univariate Y and for multivariate Y when prior is a single matrix) |
estimate_prior_method | the method used for estimating prior variance: "optim", "uniroot" and "em" for univariate Y, "optim" and "simple" for multivariate Y. |
check_null_threshold | when prior variance is estimated, compare the estimate with the null and set prior variance to null (zero) unless the log-likelihood
using the estimate is larger than that of null by this threshold. For example, you can set it to 0.1 to nudge the estimate towards zero. When used with "EM" method
setting |
prior_tol | when prior variance is estimated, compare the estimated value to this tol at the end of the analysis and exclude a single effect from PIP computation if the estimated prior variance is smaller than it. |
s_init | a previous model fit with which to initialize |
coverage | coverage of confident sets. Default to 0.95 for 95% credible interval. |
min_abs_corr | minimum of absolute value of correlation allowed in a credible set. Default set to 0.5 to correspond to squared correlation of 0.25, a commonly used threshold for genotype data in genetics studies. |
n_thread | maximum number of threads to use for parallel computation (only applicable to mixture prior) |
max_iter | maximum number of iterations to perform |
tol | convergence tolerance |
verbosity | set to 0 for no message output, 1 for a concise progress bar massage output and 2 for one line of message at the end of each iteration. |
track_fit | add an attribute |
a susie fit, which is a list with some or all of the following elements
an L by p matrix of posterior inclusion probabilites
an L by p matrix of posterior means (conditional on inclusion)
an L by p matrix of posterior second moments (conditional on inclusion)
an L vector of KL divergence
an L vector of logBF
residual variance
prior variance
a vector of values of elbo achieved (objective function)
number of iterations took for convergence
convergence status
a list of `cs`, `purity` and selected `cs_index`
a vector of posterior inclusion probability
records runtime of the fitting algorithm
a vector of univariate z-scores
set.seed(1) n = 1000 p = 1000 beta = rep(0,p) beta[1:4] = 1 X = matrix(rnorm(n*p),nrow=n,ncol=p) y = X %*% beta + rnorm(n) R = t(X) %*% X z = susieR:::calc_z(X,y) res = mvsusie_rss(z,R,L=10)