Class StatisticsPRP

java.lang.Object
  |
  +--StatisticsPRP

class StatisticsPRP
extends java.lang.Object

The class contains various parametric and non-parametric probability statistics methods used in computing statistics for ProtPlot. These include: F-test, t-test, p-values for t-test, histogram, mean, stdDev, median, mode, extrema, etc.

NOTE: Statistics package (derived from MAExplorer, WebGel and GELLAB-II which were in turn derived from Numerical Recipes, and other sources).

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government and Djamel Medjahed (SAIC-Frederick). As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file.

Version:
$Date: 2002/10/14 20:17:17 $ $Revision: $
Author:
P. Lemkin (NCI), Djamel Medjahed (SAIC), NCI-Frederick, Frederick, MD
See Also:
ProtPlot Home

This work was derived from MAExplorer under the Mozilla 1.1 Open Source Public License by Peter Lemkin of the National Cancer Institute, an agency of the United States Government subject to the limitations noted in the accompanying LEGAL file. See licence info on http://maexplorer.sourceforge.org/


Field Summary
(package private)  float deltaBinH
          width of the bins computed as: nBinsH/(maxDataH-minDataH)
(package private)  double dF
          CALC: degrees of freedom T or F test
(package private)  double dFks
          CALC: degrees of freedom KS-test
(package private)  double f
          CALC: calculated f statistic
(package private)  double fStat
          CALC: f-statistic
(package private)  int[] hist
          histogram of size [0:nBinsH-1]
(package private)  double ksD
          CALC: Kolmogorov-Smirnov D statistic
(package private)  float maxDataH
          max value in data[]
(package private)  float meanAbsDevH
          mean absolute deviation
(package private)  float meanH
          mean of data[]
(package private)  int meanIdx
          index of mean in hist[]
(package private)  float medianH
           
(package private)  int medianIdx
          index of median in hist[]
(package private)  float minDataH
          min value in data[]
(package private)  float modeH
          mode of data[]
(package private)  int modeIdx
          index of mode in hist[]
(package private)  int nBinsH
          0 if none.
(package private)  double pF
          CALC: f-test p-value w/NULL hypoth
(package private)  double pKS
          CALC: Kolmogorov-Smirnov test p-value w/NULL hypoth
private static ProtPlot prp
          instance of ProtPlot
(package private)  double pT
          CALC: t-test p-value w/NULL hypoth
(package private)  float stdDevH
          standard deviation of data[]
(package private)  double t
          CALC: t or t' statistic
(package private)  java.lang.String title
          for data used in histogram
(package private)  char useTest
          CALC: 'B' or 'T' - t-test to use
private static UtilPRP util
          instance of UtilPRP
 
Constructor Summary
(package private) StatisticsPRP(ProtPlot prP)
          StatisticsPRP() - constructor
 
Method Summary
(package private)  boolean calcFprobFromVariances(int n1, int n2, double var1, double var2)
          calcFprobFromVariances() - calculate 2-tailed f probility that variables are same.
(package private)  int calcHistStats(java.lang.String title, int nBins, float[] data, int nData)
          calcHistStats() - compute and analyze histogram generating statistics.
(package private)  int calcHistStats(java.lang.String title, int nBins, float[] data, int nData, int[] hist)
          calcHistStats() - compute and analyze a histogram for whatever range of data is given.
(package private)  boolean calcKS_DandPvalues(double[] data1, int n1, double[] data2, int n2)
          calcKS_DandPvalues() - calculate Kolmogorov-Smirnov ksD, pKS, dFks from (n1,data1) and (n2,data2).
(package private)  boolean calcTandPvalues(int n1, int n2, double m1, double m2, double s1, double s2)
          calcTandPvalues() - calculate f, t, p, dF from (n1,m1,s1) and (n2,m2,s2).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

prp

private static ProtPlot prp
instance of ProtPlot

util

private static UtilPRP util
instance of UtilPRP

dF

double dF
CALC: degrees of freedom T or F test

dFks

double dFks
CALC: degrees of freedom KS-test

useTest

char useTest
CALC: 'B' or 'T' - t-test to use

t

double t
CALC: t or t' statistic

pT

double pT
CALC: t-test p-value w/NULL hypoth

f

double f
CALC: calculated f statistic

pF

double pF
CALC: f-test p-value w/NULL hypoth

fStat

double fStat
CALC: f-statistic

ksD

double ksD
CALC: Kolmogorov-Smirnov D statistic

pKS

double pKS
CALC: Kolmogorov-Smirnov test p-value w/NULL hypoth

title

java.lang.String title
for data used in histogram

meanIdx

int meanIdx
index of mean in hist[]

medianIdx

int medianIdx
index of median in hist[]

modeIdx

int modeIdx
index of mode in hist[]

nBinsH

int nBinsH
0 if none. size of histogram

hist

int[] hist
histogram of size [0:nBinsH-1]

medianH

float medianH

modeH

float modeH
mode of data[]

meanH

float meanH
mean of data[]

stdDevH

float stdDevH
standard deviation of data[]

meanAbsDevH

float meanAbsDevH
mean absolute deviation

minDataH

float minDataH
min value in data[]

maxDataH

float maxDataH
max value in data[]

deltaBinH

float deltaBinH
width of the bins computed as: nBinsH/(maxDataH-minDataH)
Constructor Detail

StatisticsPRP

StatisticsPRP(ProtPlot prP)
StatisticsPRP() - constructor
Parameters:
prp - is ProtPlot instance
Method Detail

calcFprobFromVariances

boolean calcFprobFromVariances(int n1,
                               int n2,
                               double var1,
                               double var2)
calcFprobFromVariances() - calculate 2-tailed f probility that variables are same. It computes:
    fStat - the f-statistic
    pF    - CALC: probab. vars. same
Parameters:
n1 - # samples class 1
n2 - # samples class 2
var1 - variance of class 1
var2 - variance of class 2
Returns:
false if any problems.
See Also:
MathPRP.nr_betai(double, double, double)

calcTandPvalues

boolean calcTandPvalues(int n1,
                        int n2,
                        double m1,
                        double m2,
                        double s1,
                        double s2)
calcTandPvalues() - calculate f, t, p, dF from (n1,m1,s1) and (n2,m2,s2). Use Behrens-Fisher/Satterthwaite estimate for t and dF if f-stat is < 0.05 p-value that variances are different. Otherwise use the standard student t-statistic with DF= (n1+n2-2). If you want to force the test the set useTest to 'B' or 'T', else it will pick the test to use (ie. TB or TP). It uses the algorithm described Numerical Recipes in C (1st Ed) for estimating p-value given the t-statistic using the incomplete beta function betai(). It computes:
    f - calculated f statistic
    t - t or t' statistic
    pT - t-test p-value w/NULL hypoth
    pF - f-test p-value w/NULL hypoth
    dF - degrees of freedom
 
Parameters:
n1 - # samples in class 1
n2 - # samples in class 2
m1 - sample mean class 1
m2 - sample mean class 2
s1 - sample std dev class 1
s2 - sample std dev class 2
See Also:
MathPRP.nr_betai(double, double, double), calcFprobFromVariances(int, int, double, double)

calcKS_DandPvalues

boolean calcKS_DandPvalues(double[] data1,
                           int n1,
                           double[] data2,
                           int n2)
calcKS_DandPvalues() - calculate Kolmogorov-Smirnov ksD, pKS, dFks from (n1,data1) and (n2,data2). DF= (n1+n2-2). It computes:
    ksD - D statistic
    pKS - KS test p-value w/NULL hypoth
    dFks - degrees of freedom
 
Parameters:
data1 - sample data class 1
n1 - # samples in class 1
data2 - sample data class 2
n2 - # samples in class 2

calcHistStats

int calcHistStats(java.lang.String title,
                  int nBins,
                  float[] data,
                  int nData)
calcHistStats() - compute and analyze histogram generating statistics. for whatever range of data is given. This computes and returns the results in variables of this instance: hist[0:nBins-1], medianH, modeH, meanH, stdDevH, meanAbsDevH, minDataH, maxDataH, deltaBinH
Parameters:
title - for data
nBins - size of hist[]
data - of size [0:nData-1]
nData - size of data array
Returns:
nBins if successful.
See Also:
calcHistStats(java.lang.String, int, float[], int)

calcHistStats

int calcHistStats(java.lang.String title,
                  int nBins,
                  float[] data,
                  int nData,
                  int[] hist)
calcHistStats() - compute and analyze a histogram for whatever range of data is given. This computes and returns the results in variables of this instance:
   hist[0:nBins-1], medianH, modeH, meanH,
   stdDevH, meanAbsDevH, minDataH, maxDataH, deltaBinH.
Note: if hist is int[nBins+1], then it will not be allocated.
Parameters:
title - for data
nBins - size of hist[]
data - of size [0:nData-1]
nData - size of data array
hist - opt. [nBins+1] else null in which case it will allocate it locally
Returns:
nBins if successful else 0.