These functions access basic properties or draw inferences from a fitted susie model.
susie_get_objective(res, last_only = TRUE, warning_tol = 1e-06)
susie_get_posterior_mean(res, prior_tol = 1e-09)
susie_get_posterior_sd(res, prior_tol = 1e-09)
susie_get_niter(res)
susie_get_prior_variance(res)
susie_get_residual_variance(res)
susie_get_lfsr(res)
susie_get_posterior_samples(susie_fit, num_samples)
susie_get_cs(
res,
X = NULL,
Xcorr = NULL,
coverage = 0.95,
min_abs_corr = 0.5,
dedup = TRUE,
squared = FALSE
)
susie_get_pip(res, prune_by_cs = FALSE, prior_tol = 1e-09)
A susie fit, typically an output from
susie
or one of its variants. For
susie_get_pip
and susie_get_cs
, this may instead be
the posterior inclusion probability matrix, alpha
.
If last_only = FALSE
, return the ELBO from
all iterations; otherwise return the ELBO from the last iteration
only.
Warn if ELBO is decreasing by this tolerance level.
Filter out effects having estimated prior variance smaller than this threshold.
A susie fit, an output from susie
.
The number of draws from the posterior distribution.
n by p matrix of values of the p variables (covariates) in
n samples. When provided, correlation between variables will be
computed and used to remove CSs whose minimum correlation among
variables is smaller than min_abs_corr
.
p by p matrix of correlations between variables
(covariates). When provided, it will be used to remove CSs whose
minimum correlation among variables is smaller than
min_abs_corr
.
A number between 0 and 1 specifying desired coverage of each CS.
A "purity" threshold for the CS. Any CS that contains a pair of variables with correlation less than this threshold will be filtered out and not reported.
If dedup = TRUE
, remove duplicate CSs.
If squared = TRUE
, report min, mean and
median of squared correlation instead of the absolute correlation.
Whether or not to ignore single effects not in a reported CS when calculating PIP.
susie_get_objective
returns the evidence lower bound
(ELBO) achieved by the fitted susie model and, optionally, at each
iteration of the IBSS fitting procedure.
susie_get_residual_variance
returns the (estimated or
fixed) residual variance parameter.
susie_get_prior_variance
returns the (estimated or fixed)
prior variance parameters.
susie_get_posterior_mean
returns the posterior mean for the
regression coefficients of the fitted susie model.
susie_get_posterior_sd
returns the posterior standard
deviation for coefficients of the fitted susie model.
susie_get_niter
returns the number of model fitting
iterations performed.
susie_get_pip
returns a vector containing the posterior
inclusion probabilities (PIPs) for all variables.
susie_get_lfsr
returns a vector containing the average lfsr
across variables for each single-effect, weighted by the posterior
inclusion probability (alpha).
susie_get_posterior_samples
returns a list containing the
effect sizes samples and causal status with two components: b
,
an num_variables
x num_samples
matrix of effect
sizes; gamma
, an num_variables
x num_samples
matrix of causal status random draws.
susie_get_cs
returns credible sets (CSs) from a susie fit,
as well as summaries of correlation among the variables included in
each CS. If desired, one can filter out CSs that do not meet a
specified “purity” threshold; to do this, either X
or
Xcorr
must be supplied. It returns a list with the following
elements:
A list in which each list element is a vector containing the indices of the variables in the CS.
The nominal coverage specified for each CS.
If X
or Xcorr
iis provided), the
purity of each CS.
If X
or Xcorr
is provided) the index
(number between 1 and L) of each reported CS in the supplied susie
fit.
set.seed(1)
n = 1000
p = 1000
beta = rep(0,p)
beta[1:4] = 1
X = matrix(rnorm(n*p),nrow = n,ncol = p)
X = scale(X,center = TRUE,scale = TRUE)
y = drop(X %*% beta + rnorm(n))
s = susie(X,y,L = 10)
#> Error in susie(X, y, L = 10): could not find function "susie"
susie_get_objective(s)
#> Error in susie_get_objective(s): could not find function "susie_get_objective"
susie_get_objective(s, last_only=FALSE)
#> Error in susie_get_objective(s, last_only = FALSE): could not find function "susie_get_objective"
susie_get_residual_variance(s)
#> Error in susie_get_residual_variance(s): could not find function "susie_get_residual_variance"
susie_get_prior_variance(s)
#> Error in susie_get_prior_variance(s): could not find function "susie_get_prior_variance"
susie_get_posterior_mean(s)
#> Error in susie_get_posterior_mean(s): could not find function "susie_get_posterior_mean"
susie_get_posterior_sd(s)
#> Error in susie_get_posterior_sd(s): could not find function "susie_get_posterior_sd"
susie_get_niter(s)
#> Error in susie_get_niter(s): could not find function "susie_get_niter"
susie_get_pip(s)
#> Error in susie_get_pip(s): could not find function "susie_get_pip"
susie_get_lfsr(s)
#> Error in susie_get_lfsr(s): could not find function "susie_get_lfsr"