Contents

  1. The Problem
  2. Bayesian Corrections
  3. Results
  4. How good is our estimate of mu?
  5. Does the method work when the true effect is known?
  6. Where next?

1. The Problem



2. Bayesian Correction



2a. Single SNP Posterior Expectation

  • Obtain a seperate \(\mu\) for each SNP.

  • At SNP \(i\),

\[H_0: \textrm{i not associated}\] \[H_1: \mu \sim N(0,W)\]

\[E(\mu_i)=E(\mu_i|H_0)P(H_0|zm)+E(\mu_i|H_1)P(H_1|zm)\]

Where

  • \(E(\mu_i|H_0)=0\): Expected value of \(\mu\) under the null.

  • \(E(\mu_i|H_1)=\hat\mu\): Expected value of \(\mu\) under the alternative. Recall, under the alternative,

\[Prior: \mu \sim N(0,W)\] \[Posterior: \mu \sim N(\hat\mu,\hat V)\]

Where \(\hat\mu= \frac{1}{\hat V}(\frac{0}{W}+\frac{zm}{1})\) and \(\hat V=(1/1+1/W)^{-1}\).

  • \(P(H_1|zm)\): The posterior weight.
maf <- maf
n1 <- 5000
n0 <- 5000
n <- n1+n0

w <- 3 # this is the prior variance (omega) - could also be set to omega/V 

zm <- z0

# post of mu|H1 ~ N(muhat,vhat)

vhat <- (1+1/w)^(-1) 

muhat <- vhat*zm # mu-hat = v-hat (0/w + zm[1]/1)

zmh1 <- dnorm(zm,mean=0,sd=sqrt(1+w)) # p(zm|h1)

zmh0 <- dnorm(zm) # p(zm|h0)

eps <- 10^-4 # choose some small epsilon

ph1 <- eps # p(h1)
  
ph0 <- 1-eps # p(h0)

h1weight <- (zmh1*ph1)/((zmh1*ph1)+(zmh0*ph0)) # p(h1|data)

mu1 <- muhat*h1weight

2b. Overall \(\mu\) Posterior Expectation

  • Obtain one \(\mu\) for all SNPs by finding shrinkage estimates of \(\mu\) and averaging over all SNPs.

\[H_0: \textrm{no association}\] \[H_i: \textrm{SNP i causal}\]

\[E(\mu)=E(\mu|H_0)P(H_0|zm)+\sum_i E(\mu_i|H_i)P(H_i|zm)\]

  • Note here that the sum of the posterior probabilities will be \(<1\) since we are now considering a null as well.
zm <- z0

pvals <- pnorm(abs(z0),lower.tail=FALSE)*2 # convert z scores to p values

tmp <- coloc:::approx.bf.p(p = pvals,
                           f=maf, type = "cc", N=n1+n1, s=n1/(n1+n1)) # find ABF

w <- 0.2^2/tmp$V # OR w = 3 (W fixed method)

vhat <- (1+1/w)^(-1) 

muhat <- vhat*zm # mu-hat = v-hat (0/w + zm[1]/1)

tmp <- tmp[,"lABF"]
p1 <- 1e-04 # hard coded - bad code - can fix later 
nsnps <- length(tmp)
prior <- c(1-nsnps*p1,rep(p1,nsnps))
tmp <- c(1,tmp) # add on extra for null model
my.denom <- coloc:::logsum(tmp + prior)
tmp1 <- exp(tmp - my.denom) 
posthi <- tmp1/sum(tmp1)
posthi <- posthi[-1] # drop null again - not sum(posthi)<1 since we have a null model as well

mu2 <- sum(muhat*posthi)

3. Results




4. How good is our Bayesian derived \(\mu\) value?



5. Does the method work when the true effect is known?


##     thr   N
## 1: 0.95 405
## 2: 0.80 549
## 3: 0.60 614
## 4: 0.90 521


6. Where next?