package uk.ac.leeds.ccg.cluster; import java.awt.*; import java.awt.event.*; import java.util.*; import java.util.*; import uk.ac.leeds.ccg.geotools.*; /** A class that implements Mantel test */ public class Mantel extends SimpleMethod implements Method, Runnable { // Members MantelTimeParameters parameters; MantelTimeParametersViewer parametersViewer; Database database; Results results; GeoRectangle geoRectangle = null; // Geotools geoRectangle // Methods public static void main(String args[]){ Mantel mantel = new Mantel(); mantel.run(); } public Mantel(){ parameters = new MantelTimeParameters(); parametersViewer = new MantelTimeParametersViewer(parameters); } public String toString() {return "Mantel";} public Parameters getParameters() {return parameters;} public ParametersViewer getParametersViewer() {return parametersViewer;} public void setData(Database d) {database=d;} public SignificanceTest getSignificanceTest(){return significanceTest;} public void setSearch(GeoRectangle r) {geoRectangle=r;} public Results getResults(){return results;} public void run(){ double to, from, x, y; double to1, from1, x1, y1; double r = 0., r2 = 0.; int nge = 0; results = new Results(); int numRuns = parameters.getNumRuns(); double thresh = parameters.getSignificanceThreshold(); double stat = (double) 0.0; System.out.println(""+this+" "+significanceTest); GeoData gcases = database.getCaseVals(); Vector points = database.getPoints(); int no_points = gcases.getSize(); int np = no_points * (no_points - 1) / 2; double space[][] = new double[no_points][no_points]; double time[][] = new double[no_points][no_points]; double t2[][] = new double[no_points][no_points]; int indic[] = new int[no_points]; int perm[] = new int[no_points]; int ntimes, mm; double ssum = 0., tsum = 0., ssq = 0., tsq = 0.; double smean = 0., tmean = 0., ssd = 0., tsd = 0.; for (int i=0; i thresh) System.out.println("Prob. of such a result is greater than " + (double) (nge+1)/(numRuns+1)); else System.out.println("Prob. of such a result is less than, or equal to " + (double) (nge+1)/(numRuns+1)); } }