# Sensitivity analysis

Specifying prior values for coloc.abf() is important, as results can be dependent on these values. Defaults of $$p_1=p_2=10^{-4}$$ seem justified in a wide range of scenarios, because these broadly correspond to a 99% belief that there is true association when we see $$p<5\times 10^{-8}$$ in a GWAS. However, choice of $$p_{12}$$ is more difficult. We hope the coloc explorer app will be helpful in exploring what various choices mean, at a per-SNP and per-hypothesis level. However, having conducted an enumeration-based coloc analysis, it is still helpful to check that any inference about colocalisation is robust to variations in prior values specified.

Continuing on from the last vignette, we have

library(coloc)
data(coloc_test_data)
attach(coloc_test_data)
## The following objects are masked from coloc_test_data (pos = 3):
##
##     D1, D2, D3, D4
## The following objects are masked from coloc_test_data (pos = 4):
##
##     D1, D2, D3, D4
my.res <- coloc.abf(dataset1=D1,
dataset2=D2,
p12=1e-6)
## PP.H0.abf PP.H1.abf PP.H2.abf PP.H3.abf PP.H4.abf
##  1.72e-07  7.15e-06  2.61e-04  8.19e-04  9.99e-01
## [1] "PP abf for shared variant: 99.9%"
my.res
## Coloc analysis of trait 1, trait 2
##
## SNP Priors
##    p1    p2   p12
## 1e-04 1e-04 1e-06
##
## Hypothesis Priors
##         H0    H1    H2       H3    H4
##  0.9899255 0.005 0.005 2.45e-05 5e-05
##
## Posterior
##        nsnps           H0           H1           H2           H3           H4
## 5.000000e+01 1.724212e-07 7.150108e-06 2.606288e-04 8.188382e-04 9.989132e-01

A sensitivity analysis can be used, post-hoc, to determine the range of prior probabilities for which a conclusion is still supported. The sensitivity() function shows this for variable $$p_{12}$$ in the bottom right plot, along with the prior probabilities of each hypothesis, which may help decide whether a particular range of $$p_{12}$$ is valid. The green region shows the region - the set of values of $$p_{12}$$ - for which $$H_4 > 0.5$$ - the rule that was specified. In this case, the conclusion of colocalisation looks quite robust. On the left (optionally) the input data are also presented, with shading to indicate the posterior probabilities that a SNP is causal if $$H_4$$ were true. This can be useful to indicate serious discrepancies also.

sensitivity(my.res,rule="H4 > 0.5")
## Results pass decision rule H4 > 0.5

Let’s fake a smaller dataset where that won’t be the case, by increasing varbeta:

Now, colocalisation is very dependent on the value of $$p_{12}$$:

my.res <- coloc.abf(dataset1=D1a,
dataset2=D2a,
p12=1e-6)
## Warning in check_dataset(d = dataset1, 1): minimum p value is: 4.4302e-05
## If this is what you expected, this is not a problem.
## If this is not as small as you expected, please check the 02_data vignette.
## PP.H0.abf PP.H1.abf PP.H2.abf PP.H3.abf PP.H4.abf
##   0.06300   0.00208   0.36500   0.00639   0.56400
## [1] "PP abf for shared variant: 56.4%"
my.res
## Coloc analysis of trait 1, trait 2
##
## SNP Priors
##    p1    p2   p12
## 1e-04 1e-04 1e-06
##
## Hypothesis Priors
##         H0    H1    H2       H3    H4
##  0.9899255 0.005 0.005 2.45e-05 5e-05
##
## Posterior
##        nsnps           H0           H1           H2           H3           H4
## 50.000000000  0.063003203  0.002078654  0.364702726  0.006394366  0.563821051
sensitivity(my.res,rule="H4 > 0.5")
## Results pass decision rule H4 > 0.5

In this case, we find there is evidence for colocalisation according to a rule $$H_4>0.5$$ only for $$p_{12} > 10^{-6}$$, which corresponds to an a priori belief that $$P(H_4) \simeq P(H_3)$$. This means but you would need to think it reasonable that $$H_4$$ is equally likely as $$H_3$$ to begin with to find these data convincing.

Note, the syntax can also consider more complicated rules:

sensitivity(my.res,rule="H4 > 3*H3 & H0 < 0.1")
## Results pass decision rule H4 > 3*H3 & H0 < 0.1