Table 1
Example of 2×2 contingency table.
| INCIDENCE | |||
|---|---|---|---|
| CLASSIFICATION | + | – | TOTAL AT RISK |
| + | P | M – P | M |
| – | C | N – C | N |
| Total | C + P | N – C + M – P | N + M |
Table 2
Functions in bayesint.
| FUNCTION GROUPING | FUNCTION | DESCRIPTION |
|---|---|---|
| table_measures | rel_risk | Relative risk, a comparative measure for 2×2 contingency table |
| odds_rat | Odds ratio, a comparative measure for 2×2 contingency table seen in Equation 1 | |
| ratios | A wrapper function returning both the relative risk and odds ratio | |
| table_tests | chi_sq_stat | χ2 statistic for testing the hypothesis of no association between the two variables in a 2×2 contingency table |
| chi_sq_test | χ2 test for the statistic | |
| random_variables | densi_frac | Prior density of a ratio of two independent beta distributions |
| distri_frac | Posterior distribution of a ratio of two independent beta distributions | |
| intervals | eqt_int_frac | The equal-tailed credible interval of a ratio of two independent beta distributions |
| hpd_int_frac | The highest posterior density credible interval of a ratio of two independent beta distributions | |
| frac_int | A wrapper function returning the equal-tailed credible interval and the highest posterior density credible interval or both (chosen by the user) |
Table 3
Haffkine’s cholera data from Greenwood and Yule [4] with numbers denoting the original tables they are from.
| 3 | 4 | 5 | 6 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | NA | T | A | NA | T | A | NA | T | A | NA | T | |
| I | 3 | 276 | 279 | 18 | 115 | 133 | 0 | 75 | 75 | 0 | 193 | 193 |
| NI | 66 | 473 | 539 | 120 | 520 | 640 | 19 | 778 | 797 | 6 | 723 | 729 |
| T | 69 | 749 | 818 | 138 | 635 | 773 | 19 | 853 | 872 | 6 | 916 | 922 |
| 7 | 8 | 9 | 10 | |||||||||
| A | NA | T | A | NA | T | A | NA | T | A | NA | T | |
| I | 8 | 200 | 208 | 5 | 105 | 110 | 4 | 192 | 196 | 27 | 5751 | 5778 |
| NI | 20 | 182 | 202 | 11 | 88 | 99 | 34 | 113 | 147 | 198 | 6351 | 6549 |
| T | 28 | 382 | 410 | 16 | 193 | 209 | 38 | 305 | 343 | 225 | 12102 | 12327 |
Table 4
Relative risks and credible intervals for data from Table 3.
| HAFFKINE | RR | INTERVAL | ||
|---|---|---|---|---|
| EQUAL-TAILED | HIGHEST POSTERIOR DENSITY | |||
| 3 | 0.0878 | [0.0513, 0.3352] | [0.0374, 0.3025] | (HPD starting values: [0.1, 0.4]) |
| 4 | 0.7218 | [0.5393, 1.0333] | [0.5218, 1.4436] | |
| 7 | 0.3885 | [0.2205, 0.7060] | [0.1881, 0.7753] | |
| 8 | 0.4091 | [0.2179, 0.7972] | [0.1476, 0.9875] | (HPD starting values: [0.2, 0.5]) |
| 9 | 0.0882 | [0.0353, 0.3319] | [0.0284, 0.3061] | |
| 10 | 0.1546 | [0.0180, 0.3946] | [0.0421, 0.4364] | |
