Class ColumnStats
- java.lang.Object
-
- kcl.waterloo.math.ColumnStats
-
public class ColumnStats extends java.lang.ObjectProvides basic statistics for the columns of a double[][] array. Columns should contain the same number of elements. Missing values should be entered as NaNs. Statistics available are :Sum
Mean
Variance
Standard deviation
Skew
Kurtosis
Minimum
Maximum
Median
Upper and Lower percentiles
Number of valid (non-NaN) values
Geometric mean
NaNs are treated as missing values and discounted from all calculations.
An internal matrix contains the following parameters in the rows specified by ColumnStats.X where X is a static final int.ColumnStats.SUM the sum of values.
ColumnStats.SUMDELTA2 the sum of squares of residuals.
ColumnStats.SUMDELTA3 the sum of cubes of residuals.
ColumnStats.SUMDELTA4 the sum of residuals to power 4.
ColumnStats.MIN minimum value.
ColumnStats.MAX maximum value.
ColumnStats.MEDIAN median value.
ColumnStats.LOWER lower percent.
ColumnStats.UPPER upper percent.
ColumnStats.SUMLOG sum of logs.
ColumnStats.N number of observations (discounting NaNs).
ColumnStats.Pct the requested percent (0 to 50):
LOWER contains these values while UPPER contains values for percent = (100-ColumnStats.Pct).
-
-
Field Summary
Fields Modifier and Type Field and Description static intLOWERstatic intMAXstatic intMEDIANstatic intMINstatic intNstatic intSUMstatic intSUMDELTA2static intSUMDELTA3static intSUMDELTA4static intSUMLOGstatic intUPPER
-
Constructor Summary
Constructors Constructor and Description ColumnStats(double[][] data)Returns statistics using 25th/75th percentilesColumnStats(double[][] data, int percentile)Returns statistics using specified percentiles
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetDimension()Returns the number of columns for the input array.double[][]getGeometricMean()Returns the geometric mean for each column of the data.double[][]getKurtosis()Returns the kurtosis of the data in each column of the input.double[][]getLower()Returns the lower pecentile for each column of the data.double[][]getMaximum()Returns the maximum value for each column of the data.double[][]getMean()Returns the mean of the data in each column of the input.double[][]getMedian()Returns the median value for each column of the data.double[][]getMinimum()Returns the minimum value for each column of the data.double[][]getN()Returns the number of data points for each column of the data.doublegetPercentile()Returns the lower pecentile used.double[][]getSD()Returns the standard deviation of the data in each column of the input.double[][]getSkew()Returns the skew of the data in each column of the input.double[][]getSum()Returns the sum of the data in each column of the input.double[][]getSummary()Returns a copy of the intermediate array used in calculations.double[][]getUpper()Returns the upper pecentile for each column of the data.double[][]getVariance()Returns the variance of the data in each column of the input.booleanisKurtosisCorrected()Returns true if bias correction is to be applied to the kurtosisbooleanisSkewCorrected()Returns true if bias correction is to be applied to the skewbooleanisVarianceCorrected()Returns true if bias correction is to be applied to the variancevoidsetKurtosisCorrected(boolean flag)Sets bias correction mode for the kurtosisvoidsetSkewCorrected(boolean flag)Sets bias correction mode for the skewvoidsetVarianceCorrected(boolean flag)Sets bias correction mode for the variance (and standard deviation)java.lang.StringtoString()
-
-
-
Field Detail
-
SUM
public static final int SUM
- See Also:
- Constant Field Values
-
SUMDELTA2
public static final int SUMDELTA2
- See Also:
- Constant Field Values
-
SUMDELTA3
public static final int SUMDELTA3
- See Also:
- Constant Field Values
-
SUMDELTA4
public static final int SUMDELTA4
- See Also:
- Constant Field Values
-
MIN
public static final int MIN
- See Also:
- Constant Field Values
-
MAX
public static final int MAX
- See Also:
- Constant Field Values
-
MEDIAN
public static final int MEDIAN
- See Also:
- Constant Field Values
-
LOWER
public static final int LOWER
- See Also:
- Constant Field Values
-
UPPER
public static final int UPPER
- See Also:
- Constant Field Values
-
SUMLOG
public static final int SUMLOG
- See Also:
- Constant Field Values
-
N
public static final int N
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ColumnStats
public ColumnStats(double[][] data)
Returns statistics using 25th/75th percentiles- Parameters:
data- the data to analyze
-
ColumnStats
public ColumnStats(double[][] data, int percentile)Returns statistics using specified percentiles- Parameters:
data- the data to analyzepercentile- the percentiles to use
-
-
Method Detail
-
getDimension
public int getDimension()
Returns the number of columns for the input array.- Returns:
- number of columns
-
getSum
public double[][] getSum()
Returns the sum of the data in each column of the input.- Returns:
- the sum
-
getMean
public double[][] getMean()
Returns the mean of the data in each column of the input.- Returns:
- the mean
-
getVariance
public double[][] getVariance()
Returns the variance of the data in each column of the input. Bias correction is applied ifvarianeCorrectedis true.- Returns:
- the variance
-
getSD
public double[][] getSD()
Returns the standard deviation of the data in each column of the input. Bias correction is applied to the variance ifvarianceCorrectedis true.- Returns:
- the standard deviation
-
getSkew
public double[][] getSkew()
Returns the skew of the data in each column of the input. Bias correction is applied to the variance ifskewCorrectedis true.- Returns:
- the skew
-
getKurtosis
public double[][] getKurtosis()
Returns the kurtosis of the data in each column of the input. Bias correction is applied to the variance ifkurtosisCorrectedis true.- Returns:
- the kurtosis
-
getMinimum
public double[][] getMinimum()
Returns the minimum value for each column of the data.- Returns:
- the minimum
-
getMaximum
public double[][] getMaximum()
Returns the maximum value for each column of the data.- Returns:
- the maximum
-
getGeometricMean
public double[][] getGeometricMean()
Returns the geometric mean for each column of the data.- Returns:
- the geometric mean
-
getN
public double[][] getN()
Returns the number of data points for each column of the data. NaNs are excluded.- Returns:
- the number of data points
-
getMedian
public double[][] getMedian()
Returns the median value for each column of the data.- Returns:
- the median
-
getLower
public double[][] getLower()
Returns the lower pecentile for each column of the data.- Returns:
- the lower pecentile
-
getUpper
public double[][] getUpper()
Returns the upper pecentile for each column of the data.- Returns:
- the upper pecentile
-
getPercentile
public double getPercentile()
Returns the lower pecentile used. The upper percentile is (100-lower percentile)- Returns:
- the pecentile
-
getSummary
public double[][] getSummary()
Returns a copy of the intermediate array used in calculations.- Returns:
- a double[][]
-
isVarianceCorrected
public boolean isVarianceCorrected()
Returns true if bias correction is to be applied to the variance- Returns:
- the correction flag
-
setVarianceCorrected
public void setVarianceCorrected(boolean flag)
Sets bias correction mode for the variance (and standard deviation)- Parameters:
flag-
-
isSkewCorrected
public boolean isSkewCorrected()
Returns true if bias correction is to be applied to the skew- Returns:
- the correction flag
-
setSkewCorrected
public void setSkewCorrected(boolean flag)
Sets bias correction mode for the skew- Parameters:
flag-
-
isKurtosisCorrected
public boolean isKurtosisCorrected()
Returns true if bias correction is to be applied to the kurtosis- Returns:
- the correction flag
-
setKurtosisCorrected
public void setKurtosisCorrected(boolean flag)
Sets bias correction mode for the kurtosis- Parameters:
flag-
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG