Skip to contents

Extract weights from sdpr function

Usage

sdprWeights(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 sdpr.

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)
sdprWeights(stat, LD)
#> 100 iter. h2: 0.00896017 max beta: 0.0694217
#> 200 iter. h2: 2.89498e-05 max beta: 0.000904136
#> 300 iter. h2: 0 max beta: -0
#> 400 iter. h2: 0 max beta: -0
#> 500 iter. h2: 0 max beta: -0
#> 600 iter. h2: 0 max beta: -0
#> 700 iter. h2: 0 max beta: 0
#> 800 iter. h2: 0 max beta: 0
#> 900 iter. h2: 0 max beta: 0
#> 1000 iter. h2: 0 max beta: 0
#> h2: 0.00059282 max: 0.001572
#>  [1] -3.831235e-04 -1.129577e-03 -1.937904e-04  2.585376e-07 -2.338619e-04
#>  [6] -8.116348e-04  1.746520e-05 -7.944865e-05  7.432338e-04 -9.228854e-04
#> [11] -3.269630e-04 -8.935657e-04  2.525299e-05  9.261776e-05  4.246958e-04
#> [16] -6.851410e-05  4.516922e-05 -4.007914e-04  1.572005e-03 -3.829927e-04
#> [21]  1.490621e-04  2.498344e-05 -1.142451e-04 -3.838799e-04 -6.680644e-04
#> [26] -1.944713e-06 -8.453856e-04 -7.342780e-04 -2.637710e-05  7.978329e-04