/***********************************************************************
This file is part of JavaNPST, a Java library of NonParametric
Statistical Tests.
Copyright (C) 2011
J. Derrac (jderrac@decsai.ugr.es)
S. Garcia (sglopez@ujaen.es)
F. Herrera (herrera@decsai.ugr.es)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
**********************************************************************/
package javanpst.examples;
import javanpst.tests.scale.moodTest.*;
import javanpst.tests.scale.siegel_TukeyTest.*;
import javanpst.tests.scale.david_BartonTest.*;
import javanpst.tests.scale.freund_Ansari_BradleyTest.*;
import javanpst.tests.scale.klotzTest.*;
import javanpst.tests.scale.sukhatmeTest.*;
import javanpst.data.structures.dataTable.DataTable;
/**
* A sample to test wheter the scale parameter of two distributions
* with equal medians (0) is equal (null hypothesis) or not.
*
* Six different tests (Sukhatme test, Freund-Ansari-Bradley test,
* Klotz test, Mood test, Siegel-Tukey test and David-Barton test)
* are used to test equality of scale parameter.
*
* @author Joaqu�n Derrac Rus (jderrac@decsai.ugr.es)
* @version 1.0
*/
public class TestScale{
public static void main(String args []){
/**
* Two samples from two populations with equal median
*/
double samples [][] = {{0.028,-0.002},
{0.029,0.016},
{0.011,0.005},
{-0.030,-0.001},
{0.017,0.000},
{0.012,0.008},
{-0.027,-0.005},
{-0.018,-0.009},
{0.022,0.001},
{-0.023,-0.019}
};
//Data is formatted
DataTable data = new DataTable(samples);
//Create tests
MoodTest mood = new MoodTest(data);
KlotzTest klotz = new KlotzTest(data);
Siegel_TukeyTest siegel = new Siegel_TukeyTest(data);
David_BartonTest david = new David_BartonTest(data);
Freund_Ansari_BradleyTest freund = new Freund_Ansari_BradleyTest(data);
SukhatmeTest sukhatme = new SukhatmeTest(data);
//Run Mood test
mood.doTest();
//Print results of the test
System.out.println("Results of Mood test:\n"+mood.printReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run Klotz test
klotz.doTest();
//Print results of the test
System.out.println("Results of Klotz test:\n"+klotz.printReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run Siegel-Tukey test
siegel.doTest();
//Print results of the test
System.out.println("Results of Siegel-Tukey test:\n"+siegel.printReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run David-Barton test
david.doTest();
//Print results of the test
System.out.println("Results of David-Barton test:\n"+david.printReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run Freund-Ansari-Bradley test
freund.doTest();
//Print results of the test
System.out.println("Results of Freund-Ansari-Bradley test:\n"+freund.printReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run Sukhatme test
sukhatme.doTest();
//Print results of the test
System.out.println("Results of Sukhatme test:\n"+sukhatme.printReport());
}//end-method
}//end-class
Ads help maintain this website.