I thank Dr. Arvind Nath for finding an important bug in the program. The bug was repaired on 12 March 2007. Users who downloaded this software on or before 12 March 2007 are asked to download again, so as not to have the bug. Actually, the only files needing to be changed are this file that you are reading, which is BlockTreat.htm, and the actual BlockTreat program, which is BlockTreat.java. New users please ignore this paragraph.
BlockTreat is not an applet. It is a stand-alone console program. One of the arrays in BlockTreat usually has a length of one million, and applets scale up to that size poorly.
To top.
Suitable browsers.
The sample programs in this file have tab characters in them. If the user plans to select and copy some of these programs, so as to paste them into an editor and save them into a file, the web browser ought to be a Microsoft Internet Explorer or one of its relatives, or else a Netscape browser or one of its relatives, or else Opera 9 or later. The relatives of Netscape include Mozilla and Mozilla Firefox.
The Netscape 4 browser is out of date, and it is unable to show English quotation marks correctly in the text. One ought to use a recent browser.
To top.
Sun Java for Microsoft Windows users.
In order to get up speed, the program uses the Java language of Sun. It is likely that the user has it. The new Macintoshes come with it. Linux users mostly know where to get it. Therefore I direct my remarks to Microsoft Windows users. Let the Microsoft Windows user “open a dos box.” The surest way to do this is to click on Start at the lower left of the monitor, and then click on Run. When Run opens its box, type cmd into the box and click on the OK button. A dos box may open, or instead a little window may open saying that cmd cannot be found. In that case, click on the OK button of the little window to close it. Then delete cmd and instead type command into the box, and click on the OK button again. This time the dos box ought to open. The type size can be adjusted at the upper left hand corner. Then type at the prompt
javaand push the Enter key. If Java is present, it will print a long list of usages and options. If Java is not present, the computer will print 'java' is not recognized as an internal or external command, operable program or batch file or Bad command or file name. If Java is not present, the user ought to click back to the present file and click on http://www.java.com/en/download/manual.jsp and then follow directions for downloading to Microsoft Windows, taking all the defaults. Then type
javaagain at the dos prompt and push Enter, to check if the installation succeeded. (I have never known it to fail.) To top.
c: cd \ mkdir myjavaspushing the Enter key at the end of each of the three lines. This myjavas is the folder where the downloads ought to go. Click back to the present file. From the present file click on BlockTreat.java using the right mouse button (not the left button,) and click to save. The user’s computer will suggest a folder to which to download. This folder will be wrong. Be sure to change the download folder to the newly created folder named c:\myjavas, or else the download will get lost in the depths of the hard disc. Then finish the download. Similarly download Temp.java, b.bat, jaco.jar, and BlockTreat.htm. Then click back to the dos box and type
cd myjavas dirusing the Enter key as before. The dir command ought to show the five files that have been downloaded. If the user is using Microsoft Internet Explorer, then the jaco.jar file may have had its name changed to jaco.zip, but this is nothing to worry about, because the b.bat file will change the name back. For other discrepancies the user is respectfully advised to consult a colleague, spouse, friend, relative, classmate, or teacher. (My daughters give me excellent advice.)
The five files are as follows: BlockTreat.java is the program to do the block and treatment tests. Temp.java is a program to call BlockTreat.java and give it some data to work on. The b.bat file is a batch file to call a compiler to compile Temp.java and BlockTreat.java, and then to start the compiled class file. The jaco.jar file is a small but sturdy compiler for the Java language. It is written by Matthias Zenger, Ph.D. His site is http://zenger.org/jaco/. He does not assert copyright, but neither does he say “public domain,” so I suppose he gets his common law copyright. BlockTreat.htm is the file you are now reading. I will explain to Microsoft Windows users how to use all these in paragraphs below. Users of other systems are respectfully requested to make suitable mental changes to what I say.
To top.
A simple example.
I quote from Gottfried E. Noether, Introduction to Statistics, A Fresh Approach, Houghton Mifflin Company, Boston, 1971. On his page 148 he says, “Here we have the average number of miles per gallon of gasoline that cars built by three different manufacturers achieved in a well-publicized economy run:”
| Gasoline Mileage for Various Cars | |||
| compacts | 20.3 | 25.6 | 24.0 |
| intermediate 6’s | 21.2 | 24.7 | 23.1 |
| intermediate 8’s | 18.2 | 19.3 | 20.6 |
| full size 8’s | 18.6 | 19.3 | 19.8 |
| sports cars | 18.5 | 20.7 | 21.4 |
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{203, 256, 240},
{ 0, 1, 2},
{212, 247, 231},
{ 0, 1, 2},
{182, 193, 206},
{ 0, 1, 2},
{186, 193, 198},
{ 0, 1, 2},
{185, 207, 214},
{ 0, 1, 2}
};
int treatments=3;
int seed=132035465;
int many=(int)1e6;
String sided="two";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
The treatments integer is the number of treatments. The seed integer is the seed of the pseudorandom numbers used in the shuffle. The user may choose it arbitrarily, and it should be changed when the user changes to another experiment. The many integer is how many times the statistic is calculated. I have set it to a million, but the user may of course alter it. The sided String is the sidedness of the alternative hypothesis. For more than two treatments it must be two. The file is a Java class, so the user must follow the grammatical rules of Java. Also, it is a good idea to be a neat freak and use the space bar and the tab key to line up commas and curly braces in columns. The empty lines made by the Enter key are not required, but they do make the program easier to read.
This first time, the user need not actually type the Temp.java file, because I have already typed it and the user has downloaded it. The dos box still being open, the user may type
bat the prompt and push Enter. Unless I have made a mistake, the computer will print
Compile has succeeded. p-value is 0.01155 normalized negated logarithm of p-value is 4.48794616311194 (un-normalized negated logarithm of p-value is only 4.461069842014335) (normalizer is 0.9940114430697696)and stop. On my computer this takes about three and a half seconds. The user knows already what a p-value is. For an explanation and example of normalized negated logarithm of p-value in Bayesian meta-analysis, I respectfully invite the user to click on http://www.toad.net/~jkaplan2/martMean.htm#Discrete. . To top.
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{203, 256, 240},
{ 0, 1, 2},
{ 247, 231},
{ 1, 2},
{182, 193, 206},
{ 0, 1, 2},
{186, 193, 198},
{ 0, 1, 2},
{185, 207, 214},
{ 0, 1, 2}
};
int treatments=3;
int seed=132035465;
int many=(int)1e6;
String sided="two";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
The user is respectfully invited to click to the dos box and type
notepad Temp.javaat the prompt. The Microsoft Windows Notepad editor will open containing the Temp.java file. The user can then make the change as I have shown and drop the file menu and click to save. Then the user can click back to the dos box and type
band push Enter as before. This time the computer will print
Compile has succeeded. p-value is 0.043309 normalized negated logarithm of p-value is 3.158512509204047 (un-normalized negated logarithm of p-value is only 3.139394813377972) (normalizer is 0.9939472470758418)The p-value and its normalized negated logarithm are much different from before, but at least we have something to show. Perhaps now it is lunch time, so the user may click on the big X at the upper right corner of the Notepad editor to close it, and similarly close the dos box, and get something to eat. To top.
The Notepad editor exists only on Microsoft Windows, so users on other platforms will be using something else. For Microsoft Windows there are many other good freeware editors, but I am trying to keep things simple for beginners on Windows. I hope advanced users on Microsoft Windows know about Metapad. It can do block indentation, something many competitors can’t.
I do not know if the b.bat file will suit Linux, but Linux users can easily change it. I have no idea what Macintosh users will need to do about b.bat.
To top.
Only two treatments: matching.
Lunch being over, I specialize to the case of only two treatments. They may be, for example, a proposed new drug and a placebo. Fourteen volunteers are matched into pairs by, say, height. That is, we ask the volunteers to stand in order of height, and we take them from the short end, two at a time. The two volunteers matched together are a block. For each block an honest coin is tossed to decide which volunteer gets the drug and which the placebo. Then the drug or placebo is administered for three weeks, and afterwards the improvement in dyne-seconds is calculated for each volunteer. Let the placebo be treatment 0 and the drug be treatment 1. Then the Temp.java file may look like this:
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{12, 32},
{ 0, 1},
{13, 10},
{ 0, 1},
{19, 28},
{ 0, 1},
{15, 19},
{ 0, 1},
{22, 31},
{ 0, 1},
{24, 26},
{ 0, 1},
{29, 30},
{ 0, 1}
};
int treatments=2;
int seed=756486721;
int many=(int)1e6;
String sided="two";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
Let the user “open a dos box” as before with Start and Run. This is a good time to make sure the downloaded copy of the present file is working. Just type
start BlockTreat.htmat the prompt and push Enter. Now there will be a second copy of the present file. The user can close one of the copies. This drill is meant to prepare the user for the time when the Internet connection fails. Now at the dos prompt type
c: cd \ cd myjavas notepad Temp.java(The myjavas folder still exists from before, so we do not try to make it again.) The Notepad editor will open with the file we were using before. It is easy to erase the old file by dropping down the Edit menu and clicking on Select All and then pushing the Backspace key. It is too tedious for the user to type in the new program, so the user may just select and copy it from the present file. Then click over to the Notepad editor and drop down the Edit menu and click on Paste. Then drop down the File menu and click on Save. Then click to the dos box and type
bas before. The computer will print
Compile has succeeded. p-value is 0.078511 normalized negated logarithm of p-value is 2.778705477495855 (un-normalized negated logarithm of p-value is only 2.5445165366221647) (normalizer is 0.9157201283941977)To top.
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{12, 32},
{ 0, 1},
{13, 10},
{ 0, 1},
{19, 28},
{ 0, 1},
{15, 19},
{ 0, 1},
{22, 31},
{ 0, 1},
{24, 26},
{ 0, 1},
{29, 30},
{ 0, 1}
};
int treatments=2;
int seed=756486721;
int many=(int)1e6;
String sided="right";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
Saving the file again and typing
bagain at the prompt, we find that the p-value is much smaller now:
Compile has succeeded. p-value is 0.039273 normalized negated logarithm of p-value is 3.4103368463736667 (un-normalized negated logarithm of p-value is only 3.2372180191160655) (normalizer is 0.9492370299310214)To top.
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{12, 32},
{ 0, 1},
{13, 10},
{ 0, 1},
{19, 28},
{ 0, 1},
{15, 19},
{ 0, 1},
{22, 31},
{ 0, 1},
{24, 26},
{ 0, 1},
{29, 28, 30},
{ 0, 0, 1}
};
int treatments=2;
int seed=756486721;
int many=(int)1e6;
String sided="right";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
The computer prints
Compile has succeeded. p-value is 0.03132 normalized negated logarithm of p-value is 3.639945969959652 (un-normalized negated logarithm of p-value is only 3.4634984078595346 ) (normalizer is 0.9515246754879514)There, the p-value is a little smaller as a result of using the supernumerary volunteer. To top.
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{12, 13, 23, 24, 27, 34, 45, 56, 45, 67, 78},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{23, 12, 3, 56, 65, 58, 97, 88, 89, 90, 65},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
};
int treatments=11;
int seed=947642168;
int many=(int)1e6;
String sided="two";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
The computer prints
Compile has succeeded. p-value is 0.005334 normalized negated logarithm of p-value is 5.234876897176044 (un-normalized negated logarithm of p-value is only 5.2336538532223145 ) (normalizer is 0.9997663662436094)Is that a one-sided or a two-sided inference? It depends. If we are asking whether the treatments are identical or not, it is two-sided. However, if we are asking whether the blocks are independent or not, it is one-sided: the alternative hypothesis asserts that the u’s are positively correlated to the v’s. This remark also applies to more than two blocks. To top.
class Temp
{
public static void main( String[] args )
{
int[][] y=
{
{12, 23, 24, 25, 16, 24, 25, 26, 27, 28, 31, 23, 30},
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2}
};
int treatments=3;
int seed=978654230;
int many=(int)1e6;
String sided="two";
BlockTreat.report( y,treatments,seed,many,sided );
}
}
This leads to
Compile has succeeded. p-value is 0.045333 normalized negated logarithm of p-value is 3.130378984753771 (un-normalized negated logarithm of p-value is only 3.0937200348824043 ) (normalizer is 0.9882892933891038)This is necessarily a two-sided test, because k is greater than 2. If k were equal to 2, we could also do a right- or left-sided test. To top.
The quote and table from Noether are copyrighted by his publisher, Houghton Mifflin. The rest of the present file is in the public domain. The date of this revision is 16 April 2008. Criticism both constructive and destructive comes to me, Harold Kaplan,
at dot
smtw2gh toadmail com
To top.