R/single_effect_regression.R
, R/single_effect_regression_rss.R
, R/single_effect_regression_ss.R
single_effect_regression.Rd
These methods fit the regression model \(y = Xb + e\), where elements of e are i.i.d. \(N(0,s^2)\), and b is a p-vector of effects to be estimated. The assumption is that b has exactly one non-zero element, with all elements equally likely to be non-zero. The prior on the coefficient of the non-zero element is \(N(0,V)\).
single_effect_regression(
y,
X,
V,
residual_variance = 1,
prior_weights = NULL,
optimize_V = c("none", "optim", "uniroot", "EM", "simple"),
check_null_threshold = 0
)
single_effect_regression_rss(
z,
Sigma,
V = 1,
prior_weights = NULL,
optimize_V = c("none", "optim", "uniroot", "EM", "simple"),
check_null_threshold = 0
)
single_effect_regression_ss(
Xty,
dXtX,
V = 1,
residual_variance = 1,
prior_weights = NULL,
optimize_V = c("none", "optim", "uniroot", "EM", "simple"),
check_null_threshold = 0
)
An n-vector.
An n by p matrix of covariates.
A scalar giving the (initial) prior variance
The residual variance.
A p-vector of prior weights.
The optimization method to use for fitting the prior variance.
Scalar specifying threshold on the log-scale to compare likelihood between current estimate and zero the null.
A p-vector of z scores.
residual_var*R + lambda*I
A p-vector.
A p-vector containing the diagonal elements of
crossprod(X)
.
A list with the following elements:
Vector of posterior inclusion probabilities;
alpha[i]
is posterior probability that the ith coefficient
is non-zero.
Vector of posterior means (conditional on inclusion).
Vector of posterior second moments (conditional on inclusion).
Vector of log-Bayes factors for each variable.
Log-Bayes factor for the single effect regression.
single_effect_regression
and single_effect_regression_ss
additionally output:
Prior variance (after optimization if optimize_V !=
"none"
).
The log-likelihood, \(\log p(y | X, V)\).
single_effect_regression_ss
performs single-effect
linear regression with summary data, in which only the statistcs
\(X^Ty\) and diagonal elements of \(X^TX\) are provided to the
method.
single_effect_regression_rss
performs single-effect linear
regression with z scores. That is, this function fits the
regression model \(z = R*b + e\), where e is \(N(0,Sigma)\),
\(Sigma = residual_var*R + lambda*I\), and the b is a p-vector of
effects to be estimated. The assumption is that b has exactly one
non-zero element, with all elements equally likely to be non-zero.
The prior on the non-zero element is \(N(0,V)\). The required
summary data are the p-vector z
and the p by p matrix
Sigma
. The summary statistics should come from the same
individuals.