Skip to contents

Fits SCAD-penalized regression on the RSS objective, searching over a shrinkage grid s and lambda path. Model selection uses LD-quadratic pseudovalidation by default.

Usage

scadRssWeights(
  stat,
  ldReference,
  s = c(0.2, 0.5, 0.9, 1),
  gamma = 3.7,
  alpha = 1,
  selection = c("ldQuadratic", "minFbeta"),
  fitRetention = c("none", "slim", "full"),
  methodArgs = PenalizedRssOptions()
)

Arguments

stat

A list of summary statistics: n (per-variant sample sizes) and the marginal effects as cor (standardized), z, b with seb, or b alone, taken as already standardized. The engine receives the standardized effects z / sqrt(n), with n the median of n.

ldReference

The LD reference the statistics' variants are matched to by stat$variantNames: a genotype panel (see readGenotypes), a GenotypeMixture or an LdMatrix. A genotype reference's LD is used through its standardized genotypes, never formed as a matrix.

s

Numeric vector of LD shrinkage parameters. Default: c(0.2, 0.5, 0.9, 1.0).

gamma

SCAD concavity parameter. Default 3.7.

alpha

Elastic-net mixing (1 = pure L1). Default 1.

selection

Selection strategy: "ldQuadratic" (default) or "minFbeta".

fitRetention

How much of the search is kept as the "fit" attribute of the returned weights. "none" (default) attaches nothing. "slim" keeps path, a table with one row per candidate (s, lambda) giving the solver's objective fbeta, loss, convergence flag conv and number of non-zero coefficients nparams, with selected marking the candidate returned. "full" also keeps beta, the candidates' coefficients (variants x candidates, in the rows' order).

methodArgs

Options forwarded to the solver, penalizedRss, built with PenalizedRssOptions. 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 SNP coefficient weights. Unless fitRetention = "none", the search is attached as attribute "fit".

Examples

data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:30]
y <- eqtlRegionExample$yRes
ss <- lapply(
  seq_len(ncol(X)), function(j) coef(summary(lm(y ~ X[, j])))[2, 1:2])
stat <- list(
  b = vapply(ss, `[`, numeric(1), 1L),
  seb = vapply(ss, `[`, numeric(1), 2L),
  n = rep(nrow(X), ncol(X)),
  variantNames = colnames(X)
)
scadRssWeights(stat, LdMatrix(cor(X)))
#>  [1] -0.071983775 -0.071984658  0.008255016  0.003332318  0.003060902
#>  [6] -0.025291893  0.000000000  0.042103869  0.030591353  0.030598106
#> [11] -0.016625725 -0.071248091 -0.034728580  0.030227177 -0.016522295
#> [16]  0.042087358 -0.011820491 -0.006636111  0.033426894 -0.006638181
#> [21] -0.006628261 -0.025315011 -0.006623647 -0.020672195 -0.034772138
#> [26] -0.025316781 -0.076188500  0.010455418  0.074157044  0.006448701
#> attr(,"penalized_rss_selection")
#>                   mode                  index                penalty 
#>          "ldQuadratic"                    "6"                 "SCAD" 
#>                      s                 lambda 
#>                  "0.2" "0.000615848211066027"