Table of Contents

Introduction
Which browsers?
Buttons and text areas and an example
A big messy example
License, revision date, and e-mail address

Introduction

This page is a toy program to build a test for a given composite null hypothesis having finitely many members against a given composite alternative hypothesis having finitely many members, where the given sample space contains only finitely many points. The value of “n” must be 1. (In theory this does not reduce the generality.) The test built is deterministic, with no Monte Carlo. The test built is the best test for the given “alpha” value. Everybody would use this program except for one little difficulty: the program usually takes too much time to run. Other things being equal, the time is proportional to the kth power of 2, where k is the number of points in the sample space.

That is to say, this page is to amuse students of mathematical statistics. Researchers in science will find it useless.

In two of the following sections are examples showing use of the program. The reader is respectfully invited to try out the examples 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.) In particular, please remember that starting an integer with a zero may force the use of base 8.
To top.

Which browsers?

Only two Web browsers will work this page correctly. They are Google Chrome and Safari. Those two have speedy JavaScript, and their timeout intervals are convenient. Other browsers have slow JavaScript, and/or their timeout intervals are much too small or much too big.
To top.

Buttons and text areas and an example

This file begins with three buttons called “More rows,” “Fewer rows,” and “Clear.” These operate on the text area which immediately follows them. I will call that the “upper text area.” After that is a button called “Go AllSubSets,” which I will explain below. Then there are three buttons like the first three of this file. These operate on the text area which immediately follows them. I will call it the “lower text area.” Here is an example of a use of all this:
[
5,
.05,
	[
	function( j ){ return j*j; },
	function( j ){ return j*j*j; }
	],

	[
	function( j ){ return j; }
	]
] 
This is a JavaScript array having four non-empty rows. It begins with the number 5, which is the number of points in the sample space. On the next line is five percent, which is the desired “alpha” value. Next is a two-row array containing two functions. Each function is the numerator of a member of the null hypothesis. (The normalizing denominator is found by the program, so the reader need not worry about it.) That array is followed by a one-row array containing one function. This is for the alternative hypothesis instead of the null. I respectfully suggest that the reader select the whole big array with the mouse, copy to the clipboard, move to the upper text area, click on the “Clear” button if need be, paste into the upper text area, and click on the “Go AllSubSets” button. The answer will appear in the lower text area. Using a Safari browser I got
bigLeastPower 0.1
bigLeastPowerTray R,R,A,A,A
mostSizeForBigLeastPower 0.03333333333333333

0.001 seconds
The power is seen to be ten percent. The size is three and a third percent. (This is less than we wished, but the sample space is discrete.) The rejection region is the points at zero and one. The acceptance region is the points at two, three, and four.
To top.

A big messy example

Now I make a change and two additions to the array in the previous section. The change and the additions are bigged and bolded.
[
20,
.05,
	[
	function( j ){ return j*j; },
	function( j ){ return j*j*j; },
	function( j ){ return 1/( 1+j ); }
	],

	[
	function( j ){ return j; },
	function( j ){ return Math.sqrt( j ); }
	]
] 
The reader sees that I have changed “k” from 5 to 20. Also I have inserted a new function, preceded by a comma, to the null hypothesis. Also I have inserted a new function, preceded by a comma, to the alternative hypothesis. Now the null hypothesis has three members, and the alternative hypothesis has two members.

Again I respectfully suggest that the reader select with the mouse and copy to the clipboard and move to the upper text area (and click on the “Clear” button if need be) and click on the “Go AllSubSets” button. The answer I got using the Safari browser was

bigLeastPower 0.05789473684210526
bigLeastPowerTray A,A,A,A,A,A,A,A,A,A,A,R,A,A,A,A,A,A,A,A
mostSizeForBigLeastPower 0.048987854251012146

0.609 seconds
The power and size are different from before. The bigLeastPowerTray is very different from before.
To top.

License, revision date, and e-mail address

All of this file is in the public domain. The date of this revision is 6 March 2012. Criticism both constructive and destructive comes to me, Harold Kaplan,
       at     dot        
smtw2gh  gmail   com

To top.
Harold Kaplan’s statistics.htm
John C. Pezzullo’s page