Table of contents.

Introduction.
Which browsers?
Independence of populations.
Run a JavaScript program.
The “Insert commas” button.
License, revision date, and e-mail address.

Introduction.

The test of this page is invented by Fisher and Pitman. All I did was implement it in JavaScript. Any mistakes are mine, not Fisher’s or Pitman’s. The nextPermutation algorithm is by Edsger Dijkstra. See Edsger W. Dijkstra, A Discipline of Programming, Prentice-Hall, Englewood Cliffs, N.J., 1976, Chapter 13. I have merely translated the algorithm into JavaScript. Any mistakes are mine, not Dijkstra’s. Also, I thank Dr. Arvind Nath for bringing to my attention the need for the present page, and for helping with it.

In a following paragraph is an example showing use of the program. The user is respectfully invited to try out this example or to use any others. The only thing to remember is: follow the grammatical rules of JavaScript. (This is because the “eval” method of JavaScript is used in picking up the data from the text area.) Also, the user is respectfully reminded that integers beginning with a zero digit will be understood to be in base eight. To top.

Which browsers?

Modern browsers such as Safari 3, Microsoft Internet Explorer 6, Netscape 7, and Opera 8 can work this page correctly. Netscape 4 is out of date and cannot work this page correctly. To top.

Independence of populations.

Here is an array copied and modified from James V. Bradley, Distribution-Free Tests, Prentice-Hall Inc., 1968, pg. 94-95 and 73-76.
[
[39, 29, 60, 40, 32],
[11,  5, 20,  8,  6]
]
The top row is chest circumference (in inches) of five subjects. Let us call this x. The bottom row is the respective total volumes of air that can be breathed in and out in one minute (in liters) for the same five subjects. Let us call this y. The null hypothesis asserts that these numbers were drawn from a population in which x is independent of y. The user is respectfully invited to select and copy the array, click on the “Clear” button to clear the upper text area, paste the array into that text area, and click on the “Permutation test for correlation” 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 permutation test is non-parametric. There are no assumptions of normality, no ranking. Ties are handled correctly. However, the numbers in the arrays must be integers. If the user’s data have decimal fractions, it is necessary to multiply them by a power of ten. (It is permissible to use one power of ten for x and a different power of ten for y. However, all the x numbers must use the same power of ten as each other, and similarly for the y numbers.) The program is speedy for small samples, no more than nine pairs of numbers, but it is prohibitively slow for larger samples. To top.

Run a JavaScript program.

While building this page I needed a way to run little JavaScript programs, so I constructed the “Run a JavaScript program” button. When I was done I left the button so users can practice JavaScript programming with it. If a program is in the upper text area, the button will run it. Here is a trivial example:
var x=[];
for(var j=0;j<10;j++)x[j]=j;
x;
The user is respectfully invited. 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.

Dijkstra’s program is, without doubt, copyrighted by him or by his publisher, but it seems to be distributable copyrighted freeware. The same goes for Bradley’s data. The remainder of this file is in the public domain. The date of this revision is 5 March 2012. Criticism both constructive and destructive comes to me, Harold Kaplan,
       at     dot        
smtw2gh  gmail   com
Harold Kaplan’s statistics.htm
John C. Pezzullo’s page
To top.