Created
May 27, 2019 14:18
-
-
Save philippmuench/59cbbd304619df1bcbf1835c1b771247 to your computer and use it in GitHub Desktop.
code for rebuttal of reviewer comments, additional Bayes analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = 9196 # total number of lysis positive genomes | |
y1 = 830 # number of lyssis positive genemes among colicin B positive genomes | |
n2 = 303 # total number of lysis negative genomes | |
y2 = 20 # lysis negative genomes among colicin B positive genomes | |
# SIMULATION | |
I = 10000 # simulations | |
theta1 = rbeta(I, y1 + 1, (n1 - y1) + 1) | |
theta2 = rbeta(I, y2 + 1, (n2 - y2) + 1) | |
diff = theta1 - theta2 # simulated diffs | |
# OUTPUT | |
quantiles = quantile(diff, c(0.005,0.025,0.5,0.975,0.995)) | |
print(quantiles,digits = 2) | |
print("Probability higher % lysis positive than lysis negative on colicinB:") | |
print(mean(theta1 > theta2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment