Skip to contents

This function fits the `mr.ash` model (adaptive shrinkage regression) to estimate weights for a given set of predictors and response. It uses optional prior standard deviation initialization and can accept custom initial beta values.

Usage

mrashWeights(X, y, initPriorSd = TRUE, retainFit = FALSE, ...)

Arguments

X

Numeric genotype / design matrix (samples x variants).

y

Numeric response (phenotype) vector of length nrow(X).

initPriorSd

Logical. Initialize the prior standard-deviation grid from the data. Default TRUE.

retainFit

Logical. Attach the full fitted-model object to the result. Default FALSE.

...

Additional arguments forwarded to mr.ash.

Value

A numeric vector of weights, one per variant (column of X); zero-variance columns receive weight 0. When retainFit = TRUE 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 10: max|beta|=2.1848e+00, sigma2=1.1776e+00, pi0=0.0779