Learn R Programming

corrcoverage (version 1.2.1)

z0_pp: Find PPs for SNPs and null model from Z-scores and MAFs

Description

Posterior probabilities of causality from marginal Z-scores with prior SD as a parameter

Usage

z0_pp(z, f, type, N, s, W = 0.2, p1 = 1e-04)

Arguments

z

Marginal Z-scores of SNPs

f

Minor allele frequencies

type

Type of experiment ('quant' or 'cc')

N

Total sample size

s

Proportion of cases (N1/N0+N1), ignored if type=='quant'

W

Prior for the standard deviation of the effect size parameter, beta (default 0.2)

p1

Prior probability a SNP is associated with the trait (default 1e-4)

Value

Posterior probabilities of null model (no genetic effect) and causality for each SNP

Details

Converts Z-scores to posterior probabilities of causality, including the null model of no genetic effects

Examples

Run this code
# NOT RUN {
set.seed(1)
nsnps = 100
N0 = 5000
N1 = 5000
z_scores <- rnorm(nsnps, 0, 3)

## generate example LD matrix and MAFs
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)
maf <- colMeans(X)

res <- z0_pp(z = z_scores, f = maf, type = "cc", N = N0+N1, s = N1/(N0+N1))
sum(res)
res

# }

Run the code above in your browser using DataLab