Description Usage Arguments Details Value Author(s) Examples
View source: R/corrected_cov_functions.R
Corrected coverage estimate of the causal variant in the credible set
1 | corrected_cov(pp0, mu, V, Sigma, thr, W = 0.2, nrep = 1000, pp0min = 0.001)
|
pp0 |
Posterior probabilities of SNPs |
mu |
The true effect at the CV (estimate using corrcoverage::est_mu function) |
V |
Variance of the estimated effect size (can be obtained using coloc::Var.beta.cc function) |
Sigma |
SNP correlation matrix |
thr |
Minimum threshold for fine-mapping experiment |
W |
Prior for the standard deviation of the effect size parameter, beta (W=0.2 default) |
nrep |
Number of posterior probability systems to simulate for each variant considered causal (nrep = 1000 default) |
pp0min |
Only average over SNPs with pp0 > pp0min |
Requires an estimate of the true effect at the CV (e.g. use maximum absolute z-score or output from corrcoverage::est_mu function)
Corrected coverage estimate
Anna Hutchinson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | set.seed(1)
nsnps <- 100
N0 <- 5000
N1 <- 5000
## generate example LD matrix
library(mvtnorm)
nsamples = 1000
simx <- function(nsnps, nsamples, S, maf=0.1) {
mu <- rep(0,nsnps)
rawvars <- rmvnorm(n=nsamples, mean=mu, sigma=S)
pvars <- pnorm(rawvars)
x <- qbinom(1-pvars, 1, maf)
}
S <- (1 - (abs(outer(1:nsnps,1:nsnps,`-`))/nsnps))^4
X <- simx(nsnps,nsamples,S)
LD <- cor2(X)
maf <- colMeans(X)
## generate V (variance of estimated effect sizes)
varbeta <- Var.data.cc(f = maf, N = 5000, s = 0.5)
pp <- rnorm(nsnps, 0.2, 0.05)
pp <- pp/sum(pp)
corrected_cov(pp0 = pp, mu = 4, V = varbeta, Sigma = LD, thr = 0.95, nrep = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.