Skip to contents

Searches over a grid of shrinkage parameters s (default: c(0.2, 0.5, 0.9, 1.0), matching the original lassosum and OTTERS). For each s, the LD matrix is shrunk as (1-s)*R + s*I, then lassosumRss() is called across the lambda path. Candidate selection defaults to the LD-only quadratic pseudovalidation score $$\frac{c^T \beta}{\sqrt{\beta^T R \beta}}$$ evaluated on the supplied LD matrix R. This uses the same candidate beta path as lassosumRss(), but scores each candidate directly from summary-statistics correlation c and LD, without requiring genotype.

Usage

lassosumRssWeights(
  stat,
  ldReference,
  s = c(0.2, 0.5, 0.9, 1),
  selection = c("ldQuadratic", "minFbeta"),
  fitRetention = c("none", "slim", "full"),
  methodArgs = LassosumOptions()
)

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 shrinkage parameters to search over. Default: c(0.2, 0.5, 0.9, 1.0) following Mak et al (2017) and OTTERS.

selection

Selection strategy. Default "ldQuadratic" uses \(c^T \beta / \sqrt{\beta^T R \beta}\) on the supplied LD matrix. "minFbeta" is retained as an explicit alternative for debugging.

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, lassosumRss, built with LassosumOptions. 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 the posterior SNP coefficients at the best (s, lambda). Unless fitRetention = "none", the search is attached as attribute "fit".

Details

The original lassosum pseudovalidation can be written as an LD quadratic score after centering and standardizing the reference matrix columns by the same per-variant scale: $$\mathrm{score}(\beta) = \frac{c^T \beta}{\sqrt{\beta^T R \beta}}.$$ This implementation therefore uses the supplied LD matrix directly for selection. min(fbeta) is retained only as an explicit debug option.

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)
)
w <- lassosumRssWeights(stat, LdMatrix(cor(X)), fitRetention = "slim")
head(attr(w, "fit")$path)
#> # A tibble: 6 × 7
#>       s   lambda   fbeta    loss  conv nparams selected
#>   <dbl>    <dbl>   <dbl>   <dbl> <int>   <int> <lgl>   
#> 1   0.2 0.000100 -0.0291 -0.0293     1      30 TRUE    
#> 2   0.2 0.000144 -0.0290 -0.0293     1      30 FALSE   
#> 3   0.2 0.000207 -0.0289 -0.0293     1      30 FALSE   
#> 4   0.2 0.000298 -0.0288 -0.0292     1      30 FALSE   
#> 5   0.2 0.000428 -0.0285 -0.0292     1      30 FALSE   
#> 6   0.2 0.000616 -0.0282 -0.0292     1      29 FALSE