This function fits the `mr.ash` model (adaptive shrinkage regression) to
estimate weights for a given set of predictors and response. The prior is
susieR::mr.ash's own default mixture grid unless sa2 is
supplied through methodArgs, and custom initial beta values are
accepted.
Usage
mrashWeights(
X,
y,
fitRetention = c("none", "slim", "full"),
methodArgs = MrashOptions()
)Arguments
- X
Numeric genotype / design matrix (samples x variants).
- y
Numeric response (phenotype) vector of length
nrow(X).- fitRetention
How much of the fit is kept as the
"fit"attribute of the returned weights:"none"(default) attaches nothing,"slim"and"full"attach the fitted model. This engine keeps no trimmable intermediates, so the two retaining levels behave alike here.- methodArgs
Options forwarded to
susieR::mr.ash, built withMrashOptions. A bare list is refused: it cannot be checked against the engine, so a misspelled option would be silently ignored.
Value
A numeric vector of weights, one per variant (column of X);
zero-variance columns receive weight 0. Unless
fitRetention = "none" the fitted mr.ash object is
attached as attribute "fit".
Examples
set.seed(1)
X <- matrix(rnorm(200 * 10), nrow = 200)
y <- as.numeric(X %*% rnorm(10) + rnorm(200))
weights <- mrashWeights(X, y)
#> Mr.ASH terminated at iteration 18: max|beta|=2.1773e+00, sigma2=1.2272e+00, pi0=0.0111
#> Warning: The mixture proportion associated with the largest prior variance is greater than 4.00e-02; this indicates that the model fit could be improved by using a larger setting of the prior variance. Consider increasing the range of the variances "sa2".