snp_beta_rb: Ma et al. (2023) Winner's curse adjusted SNP effect size...

View source: R/winners_curse_adj.R

snp_beta_rbR Documentation

Ma et al. (2023) Winner's curse adjusted SNP effect size estimate

Description

Selected SNP are selected at |beta / se_beta + Z| > lambda; Z ~ N(0, sd = eta)

Usage

snp_beta_rb(
  beta,
  se_beta,
  eta = 0.5,
  alpha = 5e-08,
  lambda = qnorm(1 - alpha/2),
  est_se_beta = TRUE
)

Arguments

beta

Selected SNP effect size estimates (numeric or matrix)

se_beta

Selected SNP effect size standard error (numeric or matrix)

eta

a prespecified constant that reflects the noise level of the pseudo SNPs

alpha

significance level.

lambda

quantile of the standard normal distribution. If specified, overrides 'alpha'.

Details

DOI: 10.1214/22-AOS2247

Value

list with elements: beta_rb, se_rb if 'est_se_beta' = TRUE and only a vector of Rao-Blackwellized estimates if 'est_se_beta' = FALSE

Examples

alpha <- 5e-5
lambda <- qnorm(1 - alpha / 2)
sim_beta1 <- rnorm(1e5, lambda, 1)
sim_beta1_rand <- abs(sim_beta1 + rnorm(1e5, 0, eta))
res_beta_rb <- t(mapply(
 snp_beta_rb, beta = sim_beta1[sim_beta1_rand > lambda], se_beta = 1))

hist(as.numeric(res_beta_rb[, 1]))
# Add the naive selection
hist(sim_beta1[sim_beta1 > lambda], add = TRUE, col = 'red')


jean997/mrScan documentation built on Dec. 20, 2024, 3:39 a.m.