/***********************************************************************
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.multiple.friedmanTest.*;
import javanpst.tests.multiple.pageTest.*;
import javanpst.data.structures.dataTable.DataTable;
/**
* A sample program for testing equality between several classifications,
* using Friedman test for the alternative hypotheses of no equal means, and
* Page test to go further, with the alternative of ordered medians
*
*
* @author Joaqu�n Derrac Rus (jderrac@decsai.ugr.es)
* @version 1.0
*/
public class TestClassification{
public static void main(String args []){
/**
* A sample of n treatments (columns) and k blocks (rows):
*/
double samples [][] = {{14,23,26,30},
{19,25,25,33},
{17,22,29,28},
{17,21,28,27},
{16,24,28,32},
{15,23,27,36},
{18,26,27,26},
{16,22,30,32}
};
//Data is formatted
DataTable data = new DataTable(samples);
//Create tests
FriedmanTest friedman = new FriedmanTest(data);
PageTest page = new PageTest(data);
//Run Friedman test
friedman.doTest();
//Print results of Friedman test
System.out.println("Results of Friedman test:\n"+friedman.printReport());
//print results of the multiple comparisons procedure
System.out.println("Results of the multiple comparisons procedure:\n"+friedman.printMultipleComparisonsProcedureReport());
System.out.println();
System.out.println("*******************");
System.out.println("*******************");
System.out.println("*******************");
System.out.println();
//Run Page test
page.doTest();
//Print results of Page test
System.out.println("Results of Page test:\n"+page.printReport());
}//end-method
}//end-class
Ads help maintain this website.