| Not attacked | Attacked | TOTALS | |
| Inoculated | 276 | 3 | 279 |
| Not-inoculated | 473 | 66 | 539 |
| TOTALS | 749 | 69 | 818 |
| 276 | 3 |
| 473 | 66 |
[ [276,66], [3,473], 1 ]Notice please that the order of numbers in the same row does not matter. The 1 in the row all by itself with no brackets around it is the null hypothesis cross-ratio. In the programs of the present file it is called “centralMultiplier.”
The user is respectfully invited to select and copy this last table, click on the “Clear” button to clear the upper text area, paste the table into that text area, and click on the “Frequentist conditional test, sharp null” button. The answers will appear in the lower text area. Doubtless the user already knows what a “p-value” is. For an explanation and example of “normalized negated log p” in Bayesian meta-analysis, I respectfully invite the user to click on martMean.htm#Discrete.
The “harmonic” is the harmonic mean of the left p-value and the right p-value. It is too small to be a frequentist p-value, but its normalized negated logarithm works correctly in Bayesian meta-analysis.
To top.
Bayesian tests.
Bayesian meta-analysis is desired because the number of p-values to be used is not known in advance, and it can even change. However, frequentist and Bayesian inference are strongly mismatched with each other, so that the normalized negated logarithm loses much information. It would be better to do a Bayes test in the first place, instead of a frequentist test. The buttons beginning with the word “Bayes” are meant to do such tests. The user is respectfully invited to click on the “Bayes conditional test, sharp null against right” button, for example. The Bayes calculation will take much more time than the frequentist calculation, but it will finish. The inference is classical: a variable called “u” is distributed uniformly from 0.5 to 1, and the “multiplier” is centralMultiplier*u/(1-u).
We compare the likelihood that the cross-ratio is 1 with the likelihood that the cross-ratio is to the right of 1. The two likelihood ratios, right over sharp and sharp over right, are printed. If “sharp/right” is a small number, then the cross-ratio seems to be to the right of 1. We ought to integrate on the “u” variable from .5 to 1, but instead we use the mid-point algorithm and extrapolate by the method of Romberg. The number “mDivs” is the number of divisions of the mid-point algorithm.
The user is respectfully warned that this Bayes inference is conditional on the margin totals, and the margin totals will change if more data are brought into the problem, so bringing in more data is forbidden. (The usual Bayes inference not conditional on the margin totals permits bringing more data.) However, independent experiments’ likelihood ratios may be multiplied together sequentially, even if the separate inferences are conditional on different margin totals.
Besides the “Bayes conditional test, sharp null against right” button, I furnish a “Bayes conditional test, sharp null against left” button. The “Bayes conditional test, sharp against (left+right)/2” button will print the mysterious word “avrg.” It means the average of the left and right likelihoods, so as to do a two-sided test.
For historical and monitory reasons I have included a button called “Bayes conditional test, left against right, beware, no sharp null.” The small likelihood ratios printed by this button are often nearly the same size as the frequentist p-values, so an innocent user may be tempted to publish those likelihood ratios. Pray do not. They have no logical connection with the sharp null hypotheses of science.
To top.
Other tables and other cross-ratios.
The user is respectfully invited to put other 2-by-2 tables into the upper text area, following my example, and obeying the grammatical laws of JavaScript. Remember always that in JavaScript an integer beginning with a zero digit is understood to be in base 8.
Now let us change the null hypothesis cross-ratio from 1 to 12:
[ [276,66], [3,473], 12 ]The user is respectfully invited as before. The p-values and likelihood ratios are quite different from before.
-1.65, 2.39, 0.46, 0.39, 0.56, -2.96, 0.38, 1.42, 1.27, -0.26, -0.51, -2.87, 0.51, 0.45, 1.24, 2.02, -2.62, -0.55, 0.65, 1.41, -1.92, 1.37, -0.68, 2.44, -1.12, 0.13, 1.43, -1.89, 2.11, 0.01, 0.74, 0.22, 0.19, -0.39, -1.41, 2.4, 0.64, -1.14, -0.11, 0.13, -0.98, 0, -0.87, -2.31, -1, 0.62, -0.62, -1.79, -1.7, -1.36, 0.3, -1.36, -1.26, 1.28, -0.9, -0.25, 3.22, 0.12, 1.6, 2.15, 1.69, -0.95, 1.17, 0.27, -0.79, 2.29, -2.22, 0.38, 1.91, 0.4, -1.03, -1.43, 0.98, -2.75, 0.85, -0.25, -0.29, 1.05, 1.12, 2.67, -0.55, -0.66, 1.06, -0.1, -0.35, -0.02, -0.49, 0.85, 0.82, 0.16, 0.91, 3.75, 0.56, -1.6, -1.74, -1.34, -1.47, -0.44, 0.15, -0.54
and here are their respective “y” numbers:
-0.52, 0.79, -0.11, 0.89, 1.39, -1.39, -1.34, 0.12, 1.24, -0.12, 1.63, -0.83, 1.29, -2.35, 0.69, 1.85, 0.32, -1.3, 2.71, 1.13, -1.5, 2.51, 1.47, 1.23, -0.49, -2.77, 0.74, -2.47, 0.45, -0.25, 0.22, 1.65, -0.12, -2.34, -0.42, 0.4, -0.18, -3.77, -0.56, 1.77, -2.28, -2.55, -0.65, -2.01, 0.51, 2, -2.15, -0.53, -0.43, -0.7, -1.59, -0.17, -0.28, 2.42, 1.46, 0.9, 0.24, 2.16, -0.63, 0.69, 0.86, -1.96, 0.48, 1.44, 0.77, 3.26, -0.92, -0.42, -2.39, -1.29, -1.59, -0.26, -0.54, -0.97, -3.34, -1.23, -0.12, 0.51, 0.99, 0.7, -2.13, 0.18, 1.48, 0.77, -1.14, -0.24, 0.19, -0.55, 1.78, 0.67, 1.14, 0.37, 0.98, 0.05, 1.27, 0.38, -1.74, -0.29, 0.5, 0.56
The most famous way to transform them into counts is to use the quadrants method of Blomqvist:
var x=[-1.65, 2.39, 0.46, 0.39, 0.56, -2.96, 0.38, 1.42, 1.27, -0.26, -0.51, -2.87, 0.51, 0.45, 1.24, 2.02, -2.62, -0.55, 0.65, 1.41, -1.92, 1.37, -0.68, 2.44, -1.12, 0.13, 1.43, -1.89, 2.11, 0.01, 0.74, 0.22, 0.19, -0.39, -1.41, 2.4, 0.64, -1.14, -0.11, 0.13, -0.98, 0, -0.87, -2.31, -1, 0.62, -0.62, -1.79, -1.7, -1.36, 0.3, -1.36, -1.26, 1.28, -0.9, -0.25, 3.22, 0.12, 1.6, 2.15, 1.69, -0.95, 1.17, 0.27, -0.79, 2.29, -2.22, 0.38, 1.91, 0.4, -1.03, -1.43, 0.98, -2.75, 0.85, -0.25, -0.29, 1.05, 1.12, 2.67, -0.55, -0.66, 1.06, -0.1, -0.35, -0.02, -0.49, 0.85, 0.82, 0.16, 0.91, 3.75, 0.56, -1.6, -1.74, -1.34, -1.47, -0.44, 0.15, -0.54]; var y=[-0.52, 0.79, -0.11, 0.89, 1.39, -1.39, -1.34, 0.12, 1.24, -0.12, 1.63, -0.83, 1.29, -2.35, 0.69, 1.85, 0.32, -1.3, 2.71, 1.13, -1.5, 2.51, 1.47, 1.23, -0.49, -2.77, 0.74, -2.47, 0.45, -0.25, 0.22, 1.65, -0.12, -2.34, -0.42, 0.4, -0.18, -3.77, -0.56, 1.77, -2.28, -2.55, -0.65, -2.01, 0.51, 2, -2.15, -0.53, -0.43, -0.7, -1.59, -0.17, -0.28, 2.42, 1.46, 0.9, 0.24, 2.16, -0.63, 0.69, 0.86, -1.96, 0.48, 1.44, 0.77, 3.26, -0.92, -0.42, -2.39, -1.29, -1.59, -0.26, -0.54, -0.97, -3.34, -1.23, -0.12, 0.51, 0.99, 0.7, -2.13, 0.18, 1.48, 0.77, -1.14, -0.24, 0.19, -0.55, 1.78, 0.67, 1.14, 0.37, 0.98, 0.05, 1.27, 0.38, -1.74, -0.29, 0.5, 0.56]; quadrants( x,y )The user is respectfully invited as before. If the user has not yet tried out the “More rows” button, this is a good time. However, the inference programs will work even if there are too few rows showing. My implementation of the quadrants function is my own, not Blomqvist’s, and any mistakes in it are mine, not his.
[ [59], [41], 1 ]The user is respectfully invited.
If I had had a sharper eye for looking at bent pennies, I might have guessed that the odds ratio of heads to tails was 1.5 rather than 1. Then the table would have looked like
[ [59], [41], 1.5 ]The user is respectfully invited.
49, -67, 8, 16, 6, 23, 28, 41, 14, 29, 56, 24, 75, 60, -48(These are copied from symmetryAroundZero.htm, and on that page one can get a right-side p-value of 0.026336669921875 by using a quite different, non-binomial, test invented by Fisher. Please see that file for the copyright on Darwin’s numbers.) The user sees that there are 13 positive numbers and 2 negative numbers. One could type
[ [13], [2], 1 ]into the upper text area of the present page and click on some of the buttons.
It is not necessary that a human do all that counting of positive and negative numbers. One can instead call the “hollow” function:
hollow( 0,[49, -67, 8, 16, 6, 23, 28, 41, 14, 29, 56, 24, 75, 60, -48] )The user is respectfully invited to select that line and copy it, to clear the upper text area, to paste, and to click on some buttons. (The meaning of the name “hollow” and the reason for the zero argument are put off to a following paragraph.) Some of the resulting p-values or likelihood ratios will be much smaller than what I just quoted from that other page. This is perhaps because Darwin’s numbers include apparent outliers, so the method recommended by Fisher using the normal distribution is unsuitable.
Here is a fictitious sample from a normal distribution. It is a big unsightly mess:
0.68, -1.93, -0.8, 1.47, 1.32, -0.28, 0.69, 0.17, -0.4, 0.61, 0.18, 0.69, 1.1, -0.14, 0.69, -2.22, -0.34, 1.23, -0.77, 1.55, -0.17, 1.56, 0.26, -1.04, 1.38, 0.29, 0.25, 0.31, -0.17, -0.03, 1.13, -1.23, 0.9, -1.26, -1.2, 0.83, 1.05, -0.14, 0.64, -0.12, 0.97, -1.83, 2.03, -0.38, -0.93, 1.64, 0.79, 0.61, -0.02, -2.2, 0.73, -0.22, 0.08, -0.67, 1.16, -0.11, 1.94, 1.47, 0.34, 0.06, -1.1, -0.42, 0, 3.27, -1.51, -0.37, -0.12, -0.16, 1.99, 1.68, 1.16, -0.05, -1.11, 0.39, 1.02, -0.89, 1.42, -1.48, 0.12, 1.72, 1.02, -1.56, 0.07, -0.51, -0.12, 2.63, 0.97, 0.01, 0.4, 0.14, 0.92, 0.22, -0.3, 1.15, -0.54, 0.9, 0.15, 0.44, 0.13, -1.82
At first we are inclined to use the hollow function as before:
hollow( 0,[0.68, -1.93, -0.8, 1.47, 1.32, -0.28, 0.69, 0.17, -0.4, 0.61, 0.18, 0.69, 1.1, -0.14, 0.69, -2.22, -0.34, 1.23, -0.77, 1.55, -0.17, 1.56, 0.26, -1.04, 1.38, 0.29, 0.25, 0.31, -0.17, -0.03, 1.13, -1.23, 0.9, -1.26, -1.2, 0.83, 1.05, -0.14, 0.64, -0.12, 0.97, -1.83, 2.03, -0.38, -0.93, 1.64, 0.79, 0.61, -0.02, -2.2, 0.73, -0.22, 0.08, -0.67, 1.16, -0.11, 1.94, 1.47, 0.34, 0.06, -1.1, -0.42, 0, 3.27, -1.51, -0.37, -0.12, -0.16, 1.99, 1.68, 1.16, -0.05, -1.11, 0.39, 1.02, -0.89, 1.42, -1.48, 0.12, 1.72, 1.02, -1.56, 0.07, -0.51, -0.12, 2.63, 0.97, 0.01, 0.4, 0.14, 0.92, 0.22, -0.3, 1.15, -0.54, 0.9, 0.15, 0.44, 0.13, -1.82] )This, however, may be inefficient. All the statistics texts explain that for light-tailed distributions the sign test gives too much weight to numbers near zero and too little weight to numbers farther away. We can repair that. We can throw away the numbers that are near and keep the numbers that are far away:
hollow( 0.4,[0.68, -1.93, -0.8, 1.47, 1.32, -0.28, 0.69, 0.17, -0.4, 0.61, 0.18, 0.69, 1.1, -0.14, 0.69, -2.22, -0.34, 1.23, -0.77, 1.55, -0.17, 1.56, 0.26, -1.04, 1.38, 0.29, 0.25, 0.31, -0.17, -0.03, 1.13, -1.23, 0.9, -1.26, -1.2, 0.83, 1.05, -0.14, 0.64, -0.12, 0.97, -1.83, 2.03, -0.38, -0.93, 1.64, 0.79, 0.61, -0.02, -2.2, 0.73, -0.22, 0.08, -0.67, 1.16, -0.11, 1.94, 1.47, 0.34, 0.06, -1.1, -0.42, 0, 3.27, -1.51, -0.37, -0.12, -0.16, 1.99, 1.68, 1.16, -0.05, -1.11, 0.39, 1.02, -0.89, 1.42, -1.48, 0.12, 1.72, 1.02, -1.56, 0.07, -0.51, -0.12, 2.63, 0.97, 0.01, 0.4, 0.14, 0.92, 0.22, -0.3, 1.15, -0.54, 0.9, 0.15, 0.44, 0.13, -1.82] )What is different is that the mysterious zero has been changed to 0.4, and this tells the hollow function to hollow out the sample by throwing away 40 percent of the numbers, the 40 percent nearest to zero. The small p-values and small likelihood ratios look smaller. The user is respectfully invited.
[ [30], [], 17 ]Those empty brackets really do have to be there. The user is respectfully invited.
[ [13,13+7/5], [], Math.pow(3/2,2) ]The user is respectfully invited.
| wife is A | wife is B | wife is C | |
| husband is A | forbidden | 1 | 9 |
| husband is B | 6 | forbidden | 4 |
| husband is C | 5 | 10 | forbidden |
[ [1,4,5], [9,6,10], 1 ]The user is respectfully invited.
| Natural smallpox | Dead | Alive |
| White | 24 | 1961 |
| Black | 6 | 133 |
| Inoculated smallpox | Dead | Alive |
| White | 470 | 4590 |
| Black | 69 | 416 |
[ [1961,6,470,416], [24,133,4590,69], 1 ]The user is respectfully invited.
var x=[ 0.48, 1.27, 0.49, 0.41, 0.9, -2.42, -0.97, 1.36, 1.18, 0.11, 0.93, -1.46, 0.85, -0.32, 1.83, 1.44, -0.22, -0.42, 0.96, 1.27, -1.3, 3.07, -0.32, 1.48, -1.31, -1.09, -0.08, -1.76, -0.32, -0.19, 0.72, 0.95, -0.05, -2.02, 0.74, 0.74, -0.36, -1.41, -0.29, -0.06, -1.77, -0.72, -1.01, -2.35, 0.06, 0.69, -0.97, -1.84, -0.19, -1.07, -1.12, -0.49, -0.96, 1.07, 0.69, -0.05, 0.62, 1.67, 0.22, 0.46, 1.31, -1.74, 0.33, 0.26, -0.81, 1.86, -1.53, -0.72, -0.79, -1.54, -0.8, -0.32, 0.68, -1.49, -1.32, -0.64, -0.26, 0.47, 0.19, 2.43, -1.11, 0.23, 0.57, 0.74, -1.51, 0.71, -0.2, 1.35, 0.24, 0.27, 0.44, 2.05, 0.69, 0.25, 0.17, -0.12, -1.25, -0.52, 0.25, -0.41 ]; var y=[ -2.13, 1.12, -0.03, -0.02, -0.34, -0.54, 1.35, 0.06, 0.09, -0.37, -1.43, -1.4, -0.34, 0.77, -0.58, 0.59, -2.4, -0.12, -0.31, 0.14, -0.62, -1.71, -0.36, 0.96, 0.19, 1.22, 1.52, -0.13, 2.43, 0.2, 0.02, -0.74, 0.24, 1.63, -2.15, 1.66, 1, 0.27, 0.18, 0.18, 0.79, 0.72, 0.14, 0.04, -1.06, -0.07, 0.35, 0.05, -1.52, -0.29, 1.41, -0.87, -0.3, 0.21, -1.59, -0.2, 2.59, -1.55, 1.37, 1.69, 0.38, 0.79, 0.84, 0.02, 0.02, 0.43, -0.69, 1.11, 2.69, 1.94, -0.23, -1.11, 0.29, -1.26, 2.17, 0.38, -0.04, 0.59, 0.94, 0.23, 0.56, -0.89, 0.49, -0.84, 1.16, -0.73, -0.28, -0.5, 0.58, -0.11, 0.47, 1.7, -0.13, -1.85, -1.91, -1.23, -0.22, 0.07, -0.1, -0.13 ]; var z=[ -2.03, 0.95, -0.62, 0.48, 0.19, 2.34, -1.69, -1.15, 0.16, -0.28, -0.63, 2.69, 0.15, -2.27, -2.2, 1.25, 1.06, -0.82, 1.44, 0.04, 0.6, -5.81, 1.91, 1.17, 0.58, -3.01, 0.7, -0.47, 0, -0.1, -0.48, 0, -0.08, -3.62, -2.73, 0.89, -0.18, -2.74, -0.32, 1.82, -1.91, -2.35, 0.23, 0.25, 0.39, 1.26, -1.52, 1.22, 0.04, 0.68, -2.05, 0.75, 0.97, 1.58, -0.34, 0.96, 1.23, -2.08, -0.55, 1, 0.05, -1.59, 0.43, 1.19, 1.56, 2.19, 1.67, -0.5, -3.72, -2.73, -0.6, 0.41, -1.02, 2.39, -4.87, -0.84, 0.15, 0.32, 0.97, -1.17, -1.64, -0.26, 1.19, -0.58, -1.38, -1.47, 0.45, -2.57, 1.68, 0.38, 0.9, 1.79, 0.2, -0.66, 0.78, 0.64, -0.22, 0.19, 0.22, 1.03 ]; octants( x,y,z )There is just one little trouble. The null hypothesis must be complete independence. It is not sufficient to make a statement about cross-ratios. I am sorry about that. Anyway, the user is respectfully invited.
[ [59], [41], 1 ]one might type
priorDensity=function( u ){var v=1-u; return 1/Math.sqrt( u*v ) };
[
[59],
[41],
1
]
This will use Jeffreys’ prior instead of Bayes’ prior. The user is respectfully warned that the grammar of JavaScript must be followed, and both of those semicolons must be there, or the program will not run. Not only that: the diagnostics of JavaScript are the third worst in all computing. To change back to Bayes’ prior it is enough to delete the line redefining priorDensity, reload the page, and, if necessary, retype the other lines.
It is by no means necessary to normalize the density, because the program will do that by itself. That is, a density of 5 will work just the same as a density of 1, and so on. The user is saved from having to do integral calculus on the density function.
To top.
The “Insert commas” button.
It may be that the user is bringing in data copied from other web pages, or from files, and is pasting the data from the clipboard to the upper text area. In that case the numbers are perhaps separated by blanks or tabulation characters or the like instead of by commas. The “Insert commas” button is meant to change such other separators to commas. The button does not always guess rightly what is expected of it, so the user is respectfully asked to look at the button’s work to make sure everything is as desired. It is a good idea to type the left and right square brackets before clicking the “Insert commas” button.
To top.
License, revision date, and e-mail address.
The quotation and table from Kendall and Stuart are copyrighted by their publisher. The table copied from Bishop et al. is copyrighted by their publisher. The remainder of this file, including the programs, is in the public domain. The date of this revision is 2 March 2012. Criticism both constructive and destructive comes to me, Harold Kaplan,
at dot
smtw2gh gmail com
To top.