Compute MCP-Penalized Weights from Summary Statistics
Source:R/regularizedRegressionWrappers.R
mcpRssWeights.RdFits MCP-penalized regression on the RSS objective, searching over a
shrinkage grid s and lambda path. Model selection uses LD-quadratic
pseudovalidation by default.
Usage
mcpRssWeights(
stat,
ldReference,
s = c(0.2, 0.5, 0.9, 1),
gamma = 3,
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 ascor(standardized),z,bwithseb, orbalone, taken as already standardized. The engine receives the standardized effects z / sqrt(n), with n the median ofn.- ldReference
The LD reference the statistics' variants are matched to by
stat$variantNames: a genotype panel (seereadGenotypes), aGenotypeMixtureor anLdMatrix. 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
MCP concavity parameter. Default 3.
- 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"keepspath, a table with one row per candidate (s,lambda) giving the solver's objectivefbeta,loss, convergence flagconvand number of non-zero coefficientsnparams, withselectedmarking the candidate returned."full"also keepsbeta, the candidates' coefficients (variants x candidates, in the rows' order).- methodArgs
Options forwarded to the solver,
penalizedRss, built withPenalizedRssOptions. 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)
)
mcpRssWeights(stat, LdMatrix(cor(X)))
#> [1] -0.071977277 -0.071987128 0.008270353 0.003377601 0.003113351
#> [6] -0.025307059 0.000000000 0.042098075 0.030566148 0.030576906
#> [11] -0.016658049 -0.071244541 -0.034723495 0.030219052 -0.016566654
#> [16] 0.042084120 -0.011827396 -0.006638213 0.033426700 -0.006613121
#> [21] -0.006588641 -0.025296423 -0.006609968 -0.020661063 -0.034771269
#> [26] -0.025330629 -0.076198426 0.010454603 0.074155355 0.006451241
#> attr(,"penalized_rss_selection")
#> mode index penalty
#> "ldQuadratic" "6" "MCP"
#> s lambda
#> "0.2" "0.000615848211066027"