[Home] DMelt member access. Java source code: flanagan.analysis.RankAnalysis
/*
* Class RankAnalysis
*
* USAGE: Matrix Rank Analysis
*
* WRITTEN BY: Dr Michael Thomas Flanagan
*
* DATE: August - September 2008
* UPDATE: 12 October 2008
*
* DOCUMENTATION:
* See Michael Thomas Flanagan's Java library web page:
* http://www.ee.ucl.ac.uk/~mflanaga/java/RankAnalysis.html
* http://www.ee.ucl.ac.uk/~mflanaga/java/
*
* Copyright (c) 2008 Michael Thomas Flanagan
*
* PERMISSION TO COPY:
*
* Permission to use, copy and modify this software and its documentation for NON-COMMERCIAL purposes is granted, without fee,
* provided that an acknowledgement to the author, Dr Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies
* and associated documentation or publications.
*
* Redistributions of the source code of this source code, or parts of the source codes, must retain the above copyright notice, this list of conditions
* and the following disclaimer and requires written permission from the Michael Thomas Flanagan:
*
* Redistribution in binary form of all or parts of this class must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution and requires written permission from the Michael Thomas Flanagan:
*
* Dr Michael Thomas Flanagan makes no representations about the suitability or fitness of the software for any or for a particular purpose.
* Dr Michael Thomas Flanagan shall not be liable for any damages suffered as a result of using, modifying or distributing this software
* or its derivatives.
*
***************************************************************************************/
package flanagan.analysis;
import flanagan.analysis.Stat;
import flanagan.analysis.Cronbach;
import flanagan.math.Fmath;
import flanagan.math.Conv;
import flanagan.math.Matrix;
import flanagan.math.ArrayMaths;
import flanagan.io.FileOutput;
import java.util.ArrayList;
import java.util.Vector;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.text.*;
public class RankAnalysis{
private double[][] values = null; // matrix of values whose rank is required
private double[][] errors = null; // matrix of errors of the values
private double[] valuesDiagonal = null; // diagonal of values whose rank is required
private double[] errorsDiagonal = null; // diagonal of errors of the values
private double[][] reducedValues = null; // reduced matrix of values whose rank is required
private double[][] reducedErrors = null; // reduced matrix of standard deviations of the values
private double[] reducedValuesDiagonal = null; // diagonal of reduced values
private double[] reducedErrorsDiagonal = null; // diagonal of reduved errors
private double[] reducedValueOverError = null; // ratio of reduced value diagonal over reduced error diagonal
private double[] probabilityValues = null; // P-values for above ratios
private double[] mcMullen = null; // Criteria of McMullen, Jaskunas and Tinoco
private int numberOfRows = 0; // number of rows
private int numberOfColumns = 0; // number of columns
private int diagonalLength = 0; // length of diagonal
private int errorType = 3; // = 0 matrix of individual errors supplied
// = 1 common error for all elements in each each row supplied
// = 2 single common error for all elements in the matrix supplied
// = 3 no error/s supplied
private double[] errorRowMeans = null; // means of the rows of errors
private double[] errorColumnMeans = null; // means of the columns of errors
private int numberOfMissingErrors = 0; // number of missing errors (entered as NaN)
private boolean rowOption = true; // = true - missing errors replaced by the appropriate row mean
// = false - missing errors replaced by the appropriate column mean
private boolean rankAnalysisDone = false; // = true when rank analysis performed
// CONSTRUCTORS
// Individual error for each value
public RankAnalysis(double[][] values, double[][] errors){
this.values = Conv.copy(values);
this.errors = Conv.copy(errors);
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(float[][] values, float[][] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(long[][] values, long[][] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(int[][] values, int[][] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(BigDecimal[][] values, BigDecimal[][] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(BigInteger[][] values, BigInteger[][] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(ArrayMaths[] values, ArrayMaths[] errors){
Matrix matv = new Matrix(values);
this.values = matv.getArrayCopy();
Matrix mate = new Matrix(errors);
this.errors = mate.getArrayCopy();
this.errorType = 0;
this.preprocessDataOne();
}
public RankAnalysis(ArrayList