Skip to contents

Extract weights from prsCs function

Usage

prsCsWeights(stat, LD, ...)

Arguments

stat

A list of summary statistics with elements b (effect sizes) and n (per-variant sample sizes).

LD

Numeric LD (correlation) matrix aligned to the variants in stat.

...

Additional arguments forwarded to prsCs.

Value

A numeric vector of the posterior SNP coefficients.

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)
prsCsWeights(stat, LD, maf = rep(0.3, ncol(X)))
#>  [1] -4.191936e-03 -1.409681e-03  2.157389e-03  1.207356e-03 -8.334473e-04
#>  [6]  9.346812e-04 -1.344887e-04  2.068986e-04 -9.264629e-05 -1.460552e-03
#> [11] -5.202535e-04 -3.350505e-03 -3.347859e-04 -1.286502e-03 -3.297239e-03
#> [16]  5.509207e-03  3.087404e-04 -2.576407e-03  4.557532e-03  4.048708e-04
#> [21] -2.260824e-05 -3.347614e-03  7.850760e-04 -1.111871e-03 -4.250475e-04
#> [26] -2.181657e-03 -1.234507e-02 -1.315675e-03  4.107100e-03  1.777364e-03