Compute L0-Penalized Weights from Summary Statistics
Source:R/regularizedRegressionWrappers.R
l0learnRssWeights.RdFits L0-penalized regression (with optional L1/L2 components) on the RSS
objective, searching over a shrinkage grid s and lambda0 path. Model
selection uses LD-quadratic pseudovalidation by default.
Arguments
- stat
A list with
$b(effect sizes) and$n(per-variant sample sizes).- LD
LD correlation matrix R (single matrix, NOT pre-shrunk).
- penalty
L0 variant:
"L0","L0L1", or"L0L2". Default"L0".- s
Numeric vector of LD shrinkage parameters. Default:
c(0.2, 0.5, 0.9, 1.0).- lambda0
Numeric vector of L0 penalty values to search over. Default:
exp(seq(log(0.001), log(1), length.out = 10)).- lambda
Numeric vector of L1 penalty values (for L0L1). Default:
c(0)(no L1 unless L0L1 is used).- lambda2
L2 penalty weight (for L0L2). Default 0.
- selection
Selection strategy:
"ld_quadratic"(default) or"min_fbeta".- maxSwaps
Maximum swap rounds per lambda. Default 100.
- ...
Additional arguments passed to
penalizedRss().
Details
The swap optimization from L0Learn is included: after coordinate descent converges, non-zero coefficients are tested for swaps with zero ones to escape local optima.
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))
)
LD <- cor(X)
l0learnRssWeights(stat, LD)
#> [1] 0.00000000 -0.04757070 0.00000000 0.00000000 0.00000000 0.00000000
#> [7] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [13] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [19] 0.08951905 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> [25] 0.00000000 0.00000000 -0.14160638 0.00000000 0.09994638 0.00000000
#> attr(,"penalized_rss_selection")
#> mode index penalty s lambda0
#> "ld_quadratic" "1" "L0" "0.2" "0.001"
#> lambda
#> "0"