Michael Thomas Flanagan's Java Scientific Library

Stat Class:     Statistical Functions and Distributions

     

This file is large and may take several seconds to load.

Last update: 3 March 2015                                                                                                                             PERMISSION TO USE
Main Page of Michael Thomas Flanagan's Java Scientific Library

This class contains the statistical and related functions:
Static methods
See separate classes;
  • ANOVA for Analysis of variance
  • PCA for the Principal Component Analysis
  • Cronbach for Cronbach's alpha consistency analysis
           
  • Matrix for statistics of matrices
Instance methods (non-static methods)
This class, Stat, is a subclass of the one-dimensional array handling class ArrayMaths. Creating an instance of Stat allows inheritence of all the methods of ArrayMaths. The following Stat methods, associated with the statistical analysis of one-dimensional arrays, are also present as instance methods:
List and details of the instance methods inherited or overridden from the superclass ArrayMaths may be found on Inherited Methods

Arrays may be entered, into most static methods and into an instance of Stat, as a range of data types including BigDecimal[] and BigInteger[]. If the array is entered as BigDecimal[] or BigInteger[] and if the called method allows arbitrary precision arithmetic the result will be returned as BigDecimal[] or BigDecimal, if it does not the result will be returned as double[] or double. A list of all the methods, in this library, using arbitrary precision arithmetic may be found on ArbitraryPrecision.

Spelling note: Methods with 'ize' in their names may also be spelt with 'ise' replacing the 'ize', e.g. standardize() and standardise() are identical methods. Methods with 'kurtosis' in their name may be spelt as 'curtosis'.
Renaming note: Several methods have been renamed at various times. All older named versions have been retained in the flanagan.jar file though they are no longer listed here.

NOTE ON STATISTICAL CONVENTIONS
Denominators, n or (n-1): The denominator of variances, covariances, standard deviations, skewnesses and kurtoses may be written as n or as n−1 depending on the statistical context, e.g

The default option for this class is n−1 but methods are provided for resetting this option to n. See Set denominator.

Weighting factors: Weighting factors may be defined in terms of the uncertainty of the observation, w, or as a simpler multiplicative factor, W, e.g.

The default option for this class is the uncertainty w but methods are provided for resetting this option to W. See Weighting factor options.

Effective sample number: In weighted estimates the sample number, n, may be replaced by an effective sample number (effective base), nEff, where

e.g. the weighted varaiance is often written as

The default option for this class is to use the effective sample number, nEff, but methods are provided for resetting this option to n. See Effective sample number.

import statement:      import flanagan.analysis.Stat;

Related classes

SUMMARY OF CONSTRUCTORS AND METHODS

See class ArrayMaths for recasting arrays if the array argument below is not of the type that you require.

Constructors for Vector<Object> public Stat(Vector<Object> vec)
for ArrayList<Object> public Stat(ArrayList<Object> list)
for double[] array public Stat(Object[] array)
for double[] array public Stat(double[] array)
for Double[] array public Stat(Double[] array)
for float[] array public Stat(float[] array)
for Float[] array public Stat(Float[] array)
for long[] array public Stat(long[] array)
for Long[] array public Stat(Long[] array)
for int[] array public Stat(int[] array)
for Integer[] array public Stat(Integer[] array)
for short[] array public Stat(short[] array)
for Short[] array public Stat(Short[] array)
for byte[] array public Stat(byte[] array)
for Byte[] array public Stat(Byte[] array)
for BigDecimal[] array public Stat(BigDecimal[] array)
for BigInteger[] array public Stat(BigInteger[] array)
for Complex[] array public Stat(Complex[] array)
for Phasor[] array public Stat(Phasor[] array)
Enter array of weights as Vector<Object> public void setWeights(Vector<Object> vec)
as ArrayList<Object> public void setWeights(ArrayList<Object> list)
as double[] array public void setWeights(Object[] array)
as double[] array public void setWeights(double[] array)
as Double[] array public void setWeights(Double[] array)
as float[] array public void setWeights(float[] array)
as Float[] array public void setWeights(Float[] array)
as long[] array public void setWeights(long[] array)
as Long[] array public void setWeights(Long[] array)
as int[] array public void setWeights(int[] array)
as Integer[] array public void setWeights(Integer[] array)
as short[] array public void setWeights(short[] array)
as Short[] array public void setWeights(Short[] array)
as byte[] array public void setWeights(byte[] array)
as Byte[] array public void setWeights(Byte[] array)
as BigDecimal[] array public void setWeights(BigDecimal[] array)
as BigInteger[] array public void setWeights(BigInteger[] array)
as Complex[] array public void setWeights(Complex[] array)
as Phasor[] array public void setWeights(Phasor[] array)
Weighting Factor Options
Instance methods public void setWeightsToBigW()
public void setWeightsToLittleW()
public void convertBigWtoLittleW() [deprecated]
Static methods public void setStaticWeightsToBigW()
public void setStaticWeightsToLittleW()
public double[] convertBigWtoLittleW(double[] bigW) [deprecated]
Effective Sample Number
Instance methods
Set to n public void useTrueN()
Set to nEff public void useEffectiveN()
Effective Sample Number
Static methods
Set to n public double setStaticTrueN()
Set to n-1 public double setStaticEffectiveN()
Arithmetic Mean
Instance methods
Arithmetic Mean public double mean_as_double()
public BigDecimal mean_as_BigDecimal()
public Complex mean_as_Complex()
Weighted Arithmetic Mean public double weightedMean_as_double()
public BigDecimal weightedMean_as_BigDecimal()
public Complex weightedMean_as_Complex()
Subtract Arithmetic Mean from the Array public double subtractMean_as_double()
public BigDecimal subtractMean_as_BigDecimal()
public Complex subtractMean_as_Complex()
Subtract Weighted Arithmetic Mean from the Array public double subtractWeightedMean_as_double()
public BigDecimal subtractWeightMean_as_BigDecimal()
public Complex subtractWeightedMean_as_Complex()
Arithmetic Mean
Static methods
Arithmetic Mean public static double mean(double[] a)
public static double mean(float[] a)
public static BigDecimal mean(BigDecimal[] a)
public static BigInteger mean(BigInteger[] a)
public static Complex mean(Complex[] a)
public static double mean(int[] a)
public static double mean(long[] a)
public static double mean(short[] a)
public static double mean(byte[] a)
Weighted Arithmetic Mean public static double mean(double[] a, double[] w)
public static float mean(float[] a, float[] w)
public static BigDecimal mean(BigDecimal[] a, BigDecimal[] w)
public static BigInteger mean(BigInteger[] a, BigInteger[] w)
public static Complex mean(Complex[] a, Complex[] w)
Subtract the Arithmetic Mean public static double[] subtractMean(double[] a)
public static float[] subtractMean(float[] a)
public static BigDecimal[] subtractMean(BigDecimal[] a)
public static BigDecimal[] subtractMean(BigInteger[] a)
public static Complex[] subtractMean(Complex[] a)
Subtract the Weighted Arithmetic Mean public static double[] subtractMean(double[] a, double[] w)
public static float[] subtractMean(float[] a, float[] w)
public static BigDecimal[] subtractMean(BigDecimal[] a, BigDecimal[] w)
public static BigDecimal[] subtractMean(BigInteger[] a, BigInteger[] w)
public static Complex[] subtractMean(Complex[] a, Complex[] w)
Geometric Mean
Instance methods
Geometric Mean public static double geometricMean_as_double()
public static Complex geometricMean_as_Complex()
Weighted Geometric Mean public static double weightedGeometricMean_as_double()
public static Complex weightedGeometricMean_as_Complex()
Geometric Mean
Static methods
Geometric Mean public static double geometricMean(double[] a)
public static float geometricMean(float[] a)
public static Complex geometricMean(Complex[] a)
public static double geometricMean(BigDecimal[] a)
public static double geometricMean(BigInteger[] a)
Weighted Geometric Mean public static double geometricMean(double[] a, double[] w)
public static float geometricMean(float[] a, float[] w)
public static Complex geometricMean( Complex[] a, Complex[] w)
public static double geometricMean(BigDecimal[] a, BigDecimal[] w)
public static double geometricMean(BigInteger[] a, BigInteger[] w)
Harmonic Mean
Instance methods
Harmonic Mean public double harmonicMean_as_double()
public Complex harmonicMean_as_Complex()
public bigDecimal harmonicMean_as_BigDecimal()
Weighted Harmonic Mean public double weightedHarmonicMean_as_double()
public Complex weightedHarmonicMean_as_Complex()
public bigDecimal weightedHarmonicMean_as_BigDecimal()
Harmonic Mean
Static methods
Harmonic Mean public static double harmonicMean(double[] a)
public static float harmonicMean(float[] a)
public static Complex harmonicMean(Complex[] a)
public static BigDecimal harmonicMean(BigDecimal[] a)
public static BigDecimal harmonicMean(BigInteger[] a)
Weighted Harmonic Mean public static double harmonicMean(double[] a, double[] w)
public static float harmonicMean(float[] a, float[] w)
public static Complex harmonicMean(Complex[] a, Complex[] w)
public static BigDecimal harmonicMean(BigDecimal[] a, BigDecimal[] w)
public static BigDecimal harmonicMean(BigInteger[] a, BigInteger[] w)
Generalized Mean
(Power Mean)
Instance methods
Generalized Mean
(Power Mean)
public double generalizedMean_as_double(double m)
public double generalizedMean_as_double(BigDecimal m)
public Complex generalizedMean_as_Complex(double m)
public Complex generalizedMean_as_Complex(Complex m)
Weighted Generalized Mean
(Weighted Power Mean)
public double weightedGeneralizedMean_as_double(double m)
public double weightedGeneralizedMean_as_double(BigDecimal m)
public Complex weightedGeneralizedMean_as_Complex(double m)
public Complex weightedGeneralizedMean_as_Complex(Complex m)
Generalized Mean
(Power Mean)
Static methods
Generalized Mean
(Power Mean)
public static double generalizedMean(double[] a, double m)
public static float generalizedMean(float[] a, float m)
public static Complex generalizedMean(Complex[] a, double m)
public static Complex generalizedMean(Complex[] a, Complexdouble m)
public static double generalizedMean(BigDecimal[] a, double m)
public static double generalizedMean(BigDecimal[] a, BigDecimal m)
public static double generalizedMean(BigInteger[] a, double m)
public static double generalizedMean(BigInteger[] a, BigInteger m)
Weighted Generalized Mean
(Weighted Power Mean)
public static double generalizedMean(double[] a, double[] w, double m)
public static float generalizedMean(float[] a, float[] w,float m)
public static Complex generalizedMean(Complex[] a, Complex[] w, double m)
public static Complex generalizedMean(Complex[] a, Complex[] w, Complexdouble m)
public static double generalizedMean(BigDecimal[] a, BigDecimal[] w, double m)
public static double generalizedMean(BigDecimal[] a, BigDecimal[] w, BigDecimal m)
public static double generalizedMean(BigInteger[] a, BigInteger[] w, double m)
public static double generalizedMean(BigInteger[] a, BigInteger[] w, BigInteger m)
Interquartile Mean
Instance methods
Interquartile Mean public double interQuartileMean_as_double()
public BigDecimal interQuartileMean_as_BigDecimal()
Interquartile Mean
Static methods
Interquartile Mean public static double interQuartileMean(double[] a)
public static float interQuartileMean(float[] a)
public static BigDecimal interQuartileMean(BigDecimal[] a)
public static BigDecimal interQuartileMean(BigInteger[] a)
Root Mean Square (rms)
Instance method
Root Mean Square (rms) public double rms()
Weighted Root Mean Square (wrms) public double weightedRms()
Root Mean Square (rms)
Static methods
Root Mean Square (rms) public static double rms(double[] a)
public static float rms(float[] a)
public static BigDecimal rms(BigDecimal[] a)
public static BigDecimal rms(BigInteger[] a)
Weighted Root Mean Square (wrms) public static double rms(double[] a, (double[] w)
public static float rms(float[] a, float[] w)
public static BigDecimal rms(BigDecimal[] a, BigDecimal[] w)
public static BigDecimal rms(BigInteger[] a, BigInteger[] w)
Median
Instance methods
Median public double median_as_double()
public BigDecimal median_as_BigDecimal()
Median
Static methods
Median public static double median(double[] a)
public static float median(float[] a)
public static double median(int[] a)
public static double median(long[] a)
public static BigDecimal median(BigDecimal[] a)
public static BigDecimal median(BigInteger[] a)
Set the denominator
Instance methods
Set to n public void setDenominatortoN()
Set to n-1 public void setDenominatortoNminusOne()
Set the denominator
Static methods
Set to n public double setStaticDenominatortoN()
Set to n-1 public double setStaticDenominatortoNminusOne()
Standard Deviation
Instance methods
Standard Deviation public double standardDeviation_as_double()
public Complex standardDeviation_as_Complex()
public double standardDeviation_as_Complex_ConjugateCalcn()
public double standardDeviation_of_ComplexModuli()
public double standardDeviation_of_ComplexRealParts()
public double standardDeviation_of_ComplexImaginaryParts()
Weighted Standard Deviation public double weightedStandardDeviation_as_double()
public Complex weightedStandardDeviation_as_Complex()
public double weightedStandardDeviation_as_Complex_ConjugateCalcn()
public oubled weightedStandardDeviation_of_ComplexModuli()
public oubled weightedStandardDeviation_of_ComplexRealParts()
public double weightedStandardDeviation_of_ComplexImaginaryParts()
Standard Deviation
Static methods
Standard Deviation public static double standardDeviation(double[] a)
public static float standardDeviation(float[] a)
public static double standardDeviation(int[] a)
public static double standardDeviation(long[] a)
public static double standardDeviation(BigDecimal[] a
public static double standardDeviation(BigInteger[] a)
public static Complex standardDeviation(Complex[] a)
public static double standardDeviationConjugateCalcn(Complex[] a)
public static double standardDeviationModuli(Complex[] a)
public static double standardDeviationRealParts(Complex[] a)
public static double standardDeviationImaginaryParts(Complex[] a)
Weighted Standard Deviation public static double standardDeviation(double[] a, double[] w)
public static float standardDeviation(float[] a, float[] w)
public static double standardDeviation(BigDecimal[] a, BigDecimal[] w)
public static double standardDeviation(BigInteger[] a, BigInteger[] w)
public static Complex standardDeviation(Complex[] a, Complex[] w)
public static double standardDeviationConjugateCalcn(Complex[] a, Complex[] w)
public static double standardDeviationModuli(Complex[] a, Complex[] w)
public static double standardDeviationRealParts(Complex[] a, Complex[] w)
public static double standardDeviationImaginaryParts(Complex[] a, Complex[] w)
Standard Error of the Mean
Instance methods
Standard Error public double standardError_as_double()
public Complex standardError_as_Complex()
public double standardError_as_Complex_ConjugateCalcn()
public double standardError_of_ComplexModuli()
public double standardError_of_ComplexRealParts()
public double standardError_of_ComplexImaginaryParts()
Weighted Standard Error public double weightedStandardError_as_double()
public Complex weightedStandardError_as_Complex()
public double weightedStandardError_as_Complex_ConjugateCalcn()
public double weightedStandardError_of_ComplexModuli()
public double weightedStandardError_of_ComplexRealParts()
public double weightedStandardError_of_ComplexImaginaryParts()
Standard Error of the Mean
Static methods
Standard Error public static double standardError(double[] a)
public static float standardError(float[] a)
public static double standardError(int[] a)
public static double standardError(long[] a)
public static double standardError(BigDecimal[] a)
public static double standardError(BigInteger[] a)
public static Complex standardError(Complex[] a)
public static double standardErrorConjugateCalcn(Complex[] a)
public static double standardErrorModuli(Complex[] a)
public static double standardErrorRealParts(Complex[] a)
public static double standardErrorImaginaryParts(Complex[] a)
Weighted Standard Error public static double standardError(double[] a, double[] w)
public static float standardError(float[] a, float[] w)
public static double standardError(BigDecimal[] a, BigDecimal[] w)
public static double standardError(BigInteger[] a, BigInteger[] w)
public static Complex standardError(Complex[] a, Complex[] w)
public static double standardErrorConjugateCalcn(Complex[] a, Complex[] w)
public static double standardErrorModuli(Complex[] a, Complex[] w)
public static double standardErrorRealParts(Complex[] a, Complex[] w)
public static double standardErrorImaginaryParts(Complex[] a, Complex[] w)
Volatility
Instance methods
Volatility public double volatilityLogChange()
public double volatilityPerCentChange()
Volatility
Static methods
Volatility public static double volatilityLogChange(double[] a)
public static float volatilityLogChange(float[] a)
public static double volatilityLogChange(BigDecimal[] a)
public static double volatilityLogChange(Biginteger[] a)
public static double volatilityPerCentChange(double[] a)
public static float volatilityPerCentChange(float[] a)
public static double volatilityPerCentChange(BigDecimal[] a)
public static double volatilityPerCentChange(BigInteger[] a)
Coefficient of variation
Instance methods
Coefficient of variation public double coefficientOfVariation()
Weighted coefficient of variation public double weightedCoefficientOfVariation()
Coefficient of variation
Static methods
Coefficient of variation public static double coefficientOfVariation(double[] a)
public static float coefficientOfVariation(float[] a)
public static double coefficientOfVariation(BigDecimal[] a)
public static double coefficientOfVariation(BigInteger[] a)
Weighted coefficient of variation public static double coefficientOfVariation(double[] a, double[] w)
public static float coefficientOfVariation(float[] a, float[] w)
public static double coefficientOfVariation(BigDecimal[] a,BigDecimal[] w)
public static double coefficientOfVariation(BigInteger[] a, BigInteger[] w)
Skewness
Instance methods
Moment skewness public double momentSkewness()
public double momentSkewness_as_double()
Median skewness public double medianSkewness()
public double medianSkewness_as_double()
Quartile skewness public double quartileSkewness()
public double quartileSkewness_as_double()
public BigDecimal quartileSkewness_as_BigDecimal()
Skewness
Static methods
Moment skewness public static double momentSkewness(double[] a)
public static float momentSkewness(float[] a)
public static double momentSkewness(BigDecimal[] a)
public static double momentSkewness(BigInteger[] a)
public static double momentSkewness(int[] a)
public static double momentSkewness(long[] a)
Median skewness public static double medianSkewness(double[] a)
public static float medianSkewness(float[] a)
public static double medianSkewness(BigDecimal[] a)
public static double medianSkewness(BigInteger[] a)
public static double medianSkewness(int[] a)
public static double medianSkewness(long[] a)
Quartile skewness public static double quartileSkewness(double[] a)
public static float quartileSkewness(float[] a)
public static BigDecimal quartileSkewness(BigDecimal[] a)
public static BigDecimal quartileSkewness(BigInteger[] a)
public static double quartileSkewness(int[] a)
public static double quartileSkewness(long[] a)
Kurtosis (Curtosis)
Instance methods
Kurtosis public double kurtosis()
public double kurtosis_as_double()
public BigDecimal kurtosis_as_BigDecimal()
Excess Kurtosis public double excessKurtosis()
public double excessKurtosis_as_double()
public BigDecimal excessKurtosis_as_BigDecimal()
Kurtosis (Curtosis)
Static methods
Kurtosis public static double kurtosis(double[] a)
public static float kurtosis(float[] a)
public static BigDecimal kurtosis(BigDecimal[] a)
public static BigDecimal kurtosis(BigInteger[] a)
public static double kurtosis(int[] a)
public static double kurtosis(long[] a)
Excess Kurtosis public static double excessKurtosis(double[] a)
public static float excessKurtosis(float[] a)
public static BigDecimal excessKurtosis(BigDecimal[] a)
public static BigDecimal excessKurtosis(BigInteger[] a)
public static double excessKurtosis(int[] a)
public static double excessKurtosis(long[] a)
Standardization to a mean of 0 and standard deviation of 1
Instance methods
return standardized data public double[] standardize()
Standardization to a mean of 0 and standard deviation of 1
Static methods
return standardized data public static double[] standardize(double[] a)
public static float[] standardize(float[] a)
public static double[] standardize(BigDecimal[] a)
public static double[] standardize(BigInteger[] a)
public static double[] standardize(long[] a)
public static double[] standardize(int[] a)
Scale to a new mean of and standard deviation
Instance methods
return scaled data public double[] scale(double mean, double sd)
Scale to a new mean of and standard deviation
Static methods
return scaled data public static double[] scale(double[] a, double mean, double sd)
public static float[] scale(float[] a, float mean, float sd)
public static double[] scale(BigDecimal[] a, double mean, double sd)
public static double[] scale(BigInteger[] a, double mean, double sd)
public static double[] scale(long[] a, double mean, double sd)
public static double[] scale(int[] a, double mean, double sd)
Variance
Instance methods
Variance public double variance_as_double()
public BigDecimal variance_as_BigDecimal()
public Complex variance_as_Complex()
public double variance_as_Complex_ConjugateCalcn()
public double variance_of_ComplexModuli()
public double variance_of_ComplexRealParts()
public double variance_of_ComplexImaginaryParts()
Weighted Variance public double weightedVariance_as_double()
public BigDecimal weightedVariance_as_BigDecimal()
public Complex weightedVariance_as_Complex()
public double weightedVariance_as_Complex_ConjugateCalcn()
public double weightedVariance_of_ComplexModuli()
public double weightedVariance_of_ComplexRealParts()
public double weightedVariance_of_ComplexImaginaryParts()
Variance
Static Methods
Variance public static double variance(double[] a)
public static float variance(float[] a)
public static double variance(int[] a)
public static double variance(long[] a)
public static BigDecimal variance(BigDecimal[] a)
public static BigDecimal variance(BigInteger[] a)
public static Complex variance(Complex[] a)
public static double varianceConjugateCalcn(Complex[] a)
public static double varianceModuli(Complex[] a)
public static double varianceRealParts(Complex[] a)
public static double varianceImaginaryParts(Complex[] a)
Weighted Variance public static double variance(double[] a, double[] w)
public static float variance(float[] a, float[] w)
public static BigDecimal variance(BigDecimal[] a, BigDecimal[] w)
public static BigDecimal variance(BigInteger[] a, BigInteger[] w)
public static Complex variance(Complex[] a, Complex[] w)
public static double varianceConjugateCalcn(Complex[] a, Complex[] w)
public static double varianceModuli(Complex[] a, Complex[] w)
public static double varianceRealParts(Complex[] a, Complex[] w)
public static double varianceImaginaryParts(Complex[] a, Complex[] w)
Linear Correlation Coefficient Correlation Coefficient public static double corrCoeff(double[ ] x, double[ ] y)
public static float corrCoeff(float[ ] x, float[ ] y)
public static double corrCoeff(int[ ] x, int[ ] y)
public static double corrCoeff(int[ ][] freqMatrix)
public static double corrCoeff(int freqZeroZero, int freqZeroOne, int freqOneZero, int freqOneOne)
Weighted Correlation Coefficient public static double corrCoeff(double[ ] x, double[ ] y, double[ ] w)
Cumulative Distribution Function(cdf) public static double corrCoeffCDF(double rCoeff, int nu)
Probability Density Function (pdf) public static double corrCoeffPDF(double rCoeff, int nu)
Covariance Covariance public static double covariance(double[ ] x, double[ ] y)
public static float covariance(float[ ] x, float[ ] y)
public static double covariance(int[ ] x, int[ ] y)
Weighted Covariance public static double covariance(double[ ] x, double[ ] y, double[ ] w)
Order Statistic Medians
Uniform Order Statistic Medians public static double[] uniformOrderStatisticMedians(int n)
Gaussian [normal] Order Statistic Medians
public static double[ ] gaussianOrderStatisticMedians(double mean, double sd, int n)
public static double[ ] normalOrderStatisticMedians(double mean, double sd, int n)
public static double[ ] gaussianOrderStatisticMedians(int n)
public static double[ ] normalOrderStatisticMedians(int n)
Exponential Order Statistic Medians
public static double[ ] exponentialOrderStatisticMedians(double mu, double sigma, int n)
F-Distribution Order Statistic Medians
public static double[ ] fDistributionOrderStatisticMedians(int nu1, int nu2, int n)
Fréchet Order Statistic Medians
public static double[ ] frechetOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double gamma, int n)
Gumbel (minimum order statistic) Order Statistic Medians
public static double[ ] gumbelMinOrderStatisticMedians(double mu, double sigma, int n)
Gumbel (maximum order statistic) Order Statistic Medians
public static double[ ] gumbelMaxOrderStatisticMedians(double mu, double sigma, int n)
Logistic Order Statistic Medians
public static double[ ] logisticOrderStatisticMedians(double mu, double beta, int n)
Lorentzian Order Statistic Medians
public static double[ ] lorentzianOrderStatisticMedians(double mu, double gamma, int n)
Rayleigh Order Statistic Medians
public static double[ ] rayleighOrderStatisticMedians(double beta, int n)
Weibull Order Statistic Medians
public static double[ ] weibullOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[ ] weibullOrderStatisticMedians(double sigma, double gamma, int n)
public static double[ ] weibullOrderStatisticMedians(double gamma, int n)
Gaussian (Normal) Distribution Cumulative Distribution Function(cdf) public static double gaussianCDF(double mean, double sd, double limit)
public static double normalCDF(double mean, double sd, double limit)
public static double gaussianCDF(double mean, double sd, double lowerlimit, double upperlimit)
public static double normalCDF(double mean, double sd, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double gaussianInverseCDF(double mean, double sd, double cdf)
public static double normalInverseCDF(double mean, double sd, double cdf)
public static double gaussianInverseCDF(double cdf)
public static double normalInverseCDF(double cdf)
Probability Density Function (pdf) public static double gaussianPDF(double mean, double sd, double x)
public static double normalPDF(double mean, double sd, double x)
Generate Gaussian [normal] random deviates public static double[ ] gaussianRand(double mean, double sd, int n)
public static double[ ] normalRand(double mean, double sd, int n)
public static double[ ] gaussianRand(double mean, double sd, int n, long seed)
public static double[ ] normalRand(double mean, double sd, int n, long seed)
Gaussian [normal] Order Statistic Medians
public static double[ ] gaussianOrderStatisticMedians(double mean, double sd, int n)
public static double[ ] normalOrderStatisticMedians(double mean, double sd, int n)
public static double[ ] gaussianOrderStatisticMedians(int n)
public static double[ ] normalOrderStatisticMedians(int n)
Gaussian [normal] Probability Plot
See separate class ProbabilityPlot Gaussian Probability Plot methods
Fit data to a Gaussian [normal] distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Gaussian Probability Plot methods are also fitting methods
See also Regression class method gaussian()
See also Regression class method gaussianPlot()
Box-Cox transformation See separate class BoxCox
Log-Normal Distributions
Two parameter log-normal distribution
(see below for the three parameter statistic)
Cumulative Distribution Function(cdf) public static double logNormalCDF(double mu, double sigma, double limit)
public static double logNormalTwoParCDF(double mu, double sigma, double limit)
public static double logNormalCDF(double mu, double sigma, double lowerlimit, double upperlimit)
public static double logNormalTwoParCDF(double mu, double sigma, double lowerlimit, double upperlimit)
Probability Density Function (pdf) public static double logNormalPDF(double[] array=blue>double mu, double sigma, double x)
public static double logNormalTwoParPDF(double mu, double sigma, double x)
Generate two parameter log-normal distribution random deviates public static double[ ] logNormalRand(double mu, double sigma, int n)
public static double[ ] logNormalTwoParRand(double mu, double sigma, int n)
public static double[ ] logNormalRand(double mu, double sigma, int n, long seed)
public static double[ ] logNormalTwoParRand(double mu, double sigma, int n, long seed)
Mean public static double logNormalMean(double mu, double sigma)
public static double logNormalTwoParMean(double mu, double sigma)
Median public static double logNormalMedian(double mu)
public static double logNormalTwoParMedian(double mu)
Mode public static double logNormalMode(double , double sigmamu)
public static double logNormalTwoParMode(double mu, double sigma)
Standard deviation public static double logNormalStandardDeviation(double mu, double sigma)
public static double logNormalTwoParStandardDeviation(double mu, double sigma)
Fit data to a Two Parameter Log-Normal distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
Regression class method logNormal()
Regression class method logNormalTwpPar()
Regression class method logNormalPlot()
Regression class method logNormalTwoParPlot()
Log-Normal Distributions
Three parameter log-normal distribution
(see above for the two parameter statistic)
Cumulative Distribution Function(cdf) public static double logNormalThreeParCDF(double alpha, double beta, double gamma, double limit)
public static double logNormalThreeParCDF(double alpha, double beta, double gamma, double lowerlimit, double upperlimit)
Probability Density Function (pdf) public static double logNormalThreeParPDF(double alpha, double beta, double gamma, double x)
Generate three parameter log normal distribution random deviates public static double[ ] logNormalThreeParRand(double alpha, double beta, double gamma, int n)
public static double[ ] logNormalThreeParRand(double alpha, double beta, double gamma, int n, long seed)
Mean public static double logNormalThreeParMean(double alpha, double beta, double gamma)
Median public static double logNormalThreeParMedian(double alpha, double gamma)
Mode public static double logNormalThreeParMode(double alpha, double beta, double gamma)
Standard deviation public static double logNormalThreeParStandardDeviation(double alpha, double beta, double gamma)
Fit data to a Three Parameter Log-Normal distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
Regression class method logNormalThreePar()
Regression class method logNormalThreeParPlot()
Logistic Distribution
(Sech squared Distribution)
Cumulative Distribution Function(cdf) public static double logisticCDF(double mu, double beta, double limit)
public static double logisticCDF(double mu, double beta, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double logisticInverseCDF(double mu, double beta, double cdf)
Probability Density Function (pdf) public static double logisticPDF(double mu, double beta, double x)
Generate logistic distribution random deviates public static double[ ] logisticRand(double mu, double beta, int n)
public static double[ ] logisticRand(double mu, double beta, int n, long seed)
Mean public static double logisticMean(double mu)
Median public static double logisticMedian(double mu)
Mode public static double logisticMode(double mu)
Standard deviation public static double logisticStandardDeviation(double beta)
Logistic Order Statistic Medians
public static double[ ] logisticOrderStatisticMedians(double mu, double beta, int n)
Logistic Probability Plot
See separate class ProbabilityPlot Logistic Probability Plot methods
Fit data to a logistic distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Logistic Probability Plot methods are also fitting methods
Regression class method logistic()
Regression class method logisticPlot()
Lorentzian Distribution (Cauchy Distribution) Cumulative Distribution Function(cdf) public static double lorentzianCDF(double mean, double sd, double limit)
public static double lorentzianCDF(double mean, double gamma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double lorentzianInverseCDF(double mu, double gamma, double cdf)
Probability Density Function (pdf) public static double lorentzianPDF(double mean, double gamma, double x)
Generate Lorentzian random deviates public static double[ ] lorentzianRand(double mu, double gamma, int n)
public static double[ ] lorentzianRand(double mu, double gamma, int n, long seed)
Lorentzian Order Statistic Medians
public static double[ ] lorentzianOrderStatisticMedians(double mu, double gamma, int n)
Lorentzian Probability Plot
See separate class ProbabilityPlot Lorentzian Probability Plot methods
Fit data to a Lorentzian distribution
The ProbabilityPlot class Lorentzian Probability Plot methods are also fitting methods
public static void fitOneOrSeveralDistributions()
public void fitOneOrSeveralDistributions(double[] array)
Regression class method lorentzianPlot()
Regression class method lorentzian()
Poisson Distribution Cumulative Distribution Function(cdf) public static double poissonCDF(int k, double mean)
Probability Density Function (pdf) public static double poissonPDF(int k, double mean)
Generate Poisson random deviates public static double[ ] poissonRand(double mean, int n)
public static double[ ] poissonRand(double mean, int n, long seed)
Fit data to a Poisson distribution
Regression class method poissonPlot()
Regression class method poisson()
Type 1 Extreme Value Distribution (minimum order statistic)
Gumbel Distribution (minimum order statistic)
Cumulative Distribution Function(cdf) public static double gumbelMinCDF(double mu, double sigma, double limit)
public static double gumbelMinCDF(double mean, double sigma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double gumbelMinInverseCDF(double mu, double sigma, double cdf)
Probability Density Function (pdf) public static double gumbelMinPDF(double mu, double sigma, double x)
Generate Minimal Gumbel random deviates public static double[ ] gumbelMinRand(double mu, double sigma, int n)
public static double[ ] gumbelMinRand(double mu, double sigma, int n, long seed)
Mean public static double gumbelMinMean(double mu, double sigma)
Median public static double gumbelMinMedian(double mu, double sigma)
Mode public static double gumbelMinMode(double mu, double sigma)
Standard deviation public static double gumbelMinStandardDeviation(double sigma)
Gumbel (minimum order statistic) Order Statistic Medians
public static double[ ] gumbelMinOrderStatisticMedians(double mu, double sigma, int n)
Gumbel [minimum order statistic] Probability Plot
See separate class ProbabilityPlot Gumbel [[minimum order statistic] Probability Plot methods
Fit data to a Gumbel distribution (minimum order statistic)
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Gumbel (minimum order statistic) Probability Plot methods are also fitting methods
Regression class method gumbelMinPlot()
Regression class method gumbelMin()
Regression class method gumbelMinOneParPlot()
Regression class method gumbelMinOnePar()
Regression class method gumbelMinStandardPlot()
Regression class method gumbelMinStandard()
Type 1 Extreme Value Distribution (maximum order statistic)
Gumbel Distribution (maximum order statistic)
Cumulative Distribution Function(cdf) public static double gumbelMaxCDF(double mu, double sigma, double limit)
public static double gumbelMaxCDF(double mean, double sigma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double gumbelMaxInverseCDF(double mu, double sigma, double cdf)
Probability Density Function (pdf) public static double gumbelMaxPDF(double mu, double sigma, double x)
Generate Maximal Gumbel random deviates public static double[ ] gumbelMaxRand(double mu, double sigma, int n)
public static double[ ] gumbelMaxRand(double mu, double sigma, int n, long seed)
Mean public static double gumbelMaxMean(double mu, double sigma)
Median public static double gumbelMaxMedian(double mu, double sigma)
Mode public static double gumbelMaxMode(double mu, double sigma)
Standard deviation public static double gumbelMaxStandardDeviation(double sigma)
Gumbel (maximum order statistic) Order Statistic Medians
public static double[ ] gumbelMaxOrderStatisticMedians(double mu, double sigma, int n)
Gumbel [maximum order statistic] Probability Plot
See separate class ProbabilityPlot Gumbel [[maximum order statistic] Probability Plot methods
Fit data to a Gumbel Distribution (maximum order statistic)
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Gumbel (maximum order statistic) Probability Plot methods are also fitting methods
Regression class method gumbelMaxPlot()
Regression class method gumbelMax()
Regression class method gumbelMaxOneParPlot()
Regression class method gumbelMaxOnePar()
Regression class method gumbelMaxStandardPlot()
Regression class method gumbelMaxStandard()
Type 2 Extreme Value Distribution
Fréchet Distribution
Cumulative Distribution Function(cdf) public static double frechetCDF(double mu, double sigma, double gamma, double limit)
public static double frechetCDF(double mean, double sigma, double gamma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double frechetInverseCDF(double mu, double sigma, double gamma, double cdf)
public static double frechetInverseCDF(double sigma, double gamma, double cdf)
public static double frechetInverseCDF(double gamma, double cdf)
Probability Density Function (pdf) public static double frechetPDF(double mu, double sigma, double gamma, double x)
Generate Fréchet random deviates public static double[ ] frechetRand(double mu, double sigma, double gamma, int n)
public static double[ ] frechetRand(double mu, double sigma, double gamma, int n, long seed)
Mean public static double frechetMean(double mu, double sigma, double gamma)
Mode public static double frechetMode(double mu, double sigma, double gamma)
Standard deviation public static double frechetStandardDeviation(double sigma, double gamma)
Fréchet Order Statistic Medians
public static double[ ] frechetOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double gamma, int n)
Fréchet Probability Plot
See separate class ProbabilityPlot Fréchet Probability Plot methods
Fit data to a Fréchet distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Fréchet Probability Plot methods are also fitting methods
Regression class method frechetPlot()
Regression class method frechet()
Regression class method frechetTwoParPlot()
Regression class method frechetTwoPar()
Regression class method frechetStandardPlot()
Regression class method frechetStandard()
Type 3 Extreme Value Distribution
Weibull Distribution
Cumulative Distribution Function(cdf) public static double weibullCDF(double mu, double sigma, double gamma, double limit)
public static double weibullCDF(double mean, double sigma, double gamma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double weibullInverseCDF(double mu, double sigma, double gamma, double cdf)
public static double weibullInverseCDF(double sigma, double gamma, double cdf)
public static double weibullInverseCDF(double gamma, double cdf)
Probability Density Function (pdf) public static double weibullPDF(double mu, double sigma, double gamma, double x)
Generate Weibull random deviates public static double[ ] weibullRand(double mu, double sigma, double gamma, int n)
public static double[ ] weibullRand(double mu, double sigma, double gamma, int n, long seed)
Mean public static double weibullMean(double mu, double sigma, double gamma)
Median public static double weibullMedian(double mu, double sigma, double gamma)
Mode public static double weibullMode(double mu, double sigma, double gamma)
Standard deviation public static double weibullStandardDeviation(double sigma, double gamma)
Weibull Order Statistic Medians
public static double[ ] weibullOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[ ] weibullOrderStatisticMedians(double sigma, double gamma, int n)
public static double[ ] weibullOrderStatisticMedians(double gamma, int n)
Weibull Probability Plot
See separate class ProbabilityPlot Weibull Probability Plot methods
Fit data to a Weibull distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Weibull Probability Plot methods are also fitting methods
Regression class method weibullPlot()
Regression class method weibull()
Regression class method weibullTwoParPlot()
Regression class method weibullTwoPar()
Regression class method weibullStandardPlot()
Regression class method weibullStandard()
Type 3 Extreme Value Distribution
Exponential Distribution
Cumulative Distribution Function(cdf) public static double exponentialCDF(double mu, double sigma, double limit)
public static double exponentialCDF(double mean, double sigma, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double exponentialInverseCDF(double mu, double sigma, double cdf)
Probability Density Function (pdf) public static double exponentialPDF(double mu, double sigma, double x)
Generate exponential random deviates public static double[ ] exponentialRand(double mu, double sigma, int n)
public static double[ ] exponentialRand(double mu, double sigma, int n, long seed)
Mean public static double exponentialMean(double mu, double sigma)
Median public static double exponentialMedian(double mu, double sigma)
Mode public static double exponentialMode(double mu)
Standard deviation public static double exponentialStandardDeviation(double sigma)
Exponential Order Statistic Medians
public static double[ ] exponentialOrderStatisticMedians(double mu, double sigma, int n)
Exponential Probability Plot
See separate class ProbabilityPlot Exponential Probability Plot methods
Fit data to a exponential distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Exponential Probability Plot methods are also fitting methods
Regression class method exponentialPlot()
Regression class method exponential()
Regression class method exponentialOneParPlot()
Regression class method exponentialOnePar()
Regression class method exponentialStandardPlot()
Regression class method exponentialStandard()
Type 3 Extreme Value Distribution
Rayleigh Distribution
Cumulative Distribution Function(cdf) public static double rayleighCDF(double beta, double limit)
public static double rayleighCDF(double beta, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double rayleighInverseCDF(double beta, double cdf)
Probability Density Function (pdf) public static double rayleighPDF(double beta, double x)
Generate Rayleigh random deviates public static double[ ] rayleighRand(double beta, int n)
public static double[ ] rayleighRand(double beta, int n, long seed)
Mean public static double rayleighMean(double beta)
Median public static double rayleighMedian(double beta)
Mode public static double rayleighMode(double beta)
Standard deviation public static double rayleighStandardDeviation(double beta)
Rayleigh Order Statistic Medians
public static double[ ] rayleighOrderStatisticMedians(double beta, int n)
Rayleigh Probability Plot
See separate class ProbabilityPlot Rayleigh Probability Plot methods
Fit data to a Rayleigh distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Rayleigh Probability Plot methods are also fitting methods
Regression class method rayleighPlot()
Regression class method rayleigh()
Pareto Distribution Cumulative Distribution Function(cdf) public static double paretoCDF(double alpha, double beta, double limit)
public static double paretoCDF(double alpha, double beta, double lowerlimit, double upperlimit)
Inverse Cumulative Distribution Function public static double paretoInverseCDF(double alpha, double beta, double cdf)
Probability Density Function (pdf) public static double paretoPDF(double alpha, double beta, double x)
Generate Pareto random deviates public static double[ ] paretoRand(double alpha, double beta, int n)
public static double[ ] paretoRand(double alpha, double beta, int n, long seed)
Mean public static double paretoMean(double alpha, double beta)
Mode public static double paretoMode(double beta)
Standard deviation public static double paretoStandardDeviation(double alpha, double beta)
Pareto Order Statistic Medians
public static double[ ] paretoOrderStatisticMedians(double alpha, double beta, int n)
Pareto Probability Plot
See separate class ProbabilityPlot Pareto Probability Plot methods
Fit data to a Pareto distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
The ProbabilityPlot class Pareto Probability Plot methods are also fitting methods
Regression class method paretoThreeParPlot()
Regression class method paretoThreePar()
Regression class method paretoTwoParPlot()
Regression class method paretoPlot()
Regression class method paretoTwoPar()
Regression class method pareto()
Regression class method paretoOneParPlot()
Regression class method paretoOnePar()
Binomial Distribution Cumulative Distribution Function (cdf) public static double binomalCDF(double p, int n, int k)
probability density function (pdf) public static double binomialPDF(double p, int n, int k)
Generate Binomial random deviates public static double binomialRand(int p , int nTrials, int nArrays)
public static double binomialRand(int p , int nTrials, int nArrays, long seed)
Binomial Coefficients public static double binomialCoeff(int n , int k)
Student's t Distribution Cumulative Distribution Function (cdf) public static double studentstCDF(double tValue, int nu)
public static double studentstCDF(double lowerLimit, double upperLimit, int nu)
P-value public static double pValue(double tValue, int nu)
Probability density function (pdf) public static double studentstPDF(double tValue, int nu)
Student's t value for a given cdf public static double studentstValue(double cdf, int nu)
Generate Student's t random deviates public static double[] studentstRand(int nu, int n)
public static double[] studentstRand(int nu, int n, long seed)
Mean public static double studentstMean(int nu)
Median public static double studentstMedian()
Mode public static double studentstMode()
Standard deviation public static double studentstStandardDeviation(int nu)
A(t|n) distribution public static double probAtn(double tValue, int nu)
Beta Distribution and Beta Functions Cumulative Distribution Function(cdf) public static double betaCDF(double min, double max, double alpha, double beta, double limit)
public static double betaCDF(double alpha, double beta, double limit)
Probability Density Function (pdf) public static double betaPDF(double min, double max, double alpha, double beta, double x)
public static double betaPDF(double alpha, double beta, double x)
Generate Beta random deviates public static double[ ] betaRand(double min, double max, double alpha, double beta, int n)
public static double[ ] betaRand(double alpha, double beta, int n)
public static double[ ] betaRand(double min, double max, double alpha, double beta, int n, long seed)
public static double[ ] betaRand(double alpha, double beta, int n, long seed)
Mean public static double betaMean(double min, double max, double alpha, double beta)
public static double betaMean(double alpha, double beta)
Mode public static double betaMode(double mu, , double beta, double beta,)
public static double betaMode(double alpha, double beta)
Standard deviation public static double betaStandardDeviation(double beta, double beta,)
public static double betaStandardDeviation(double alpha, double beta)
Fit data to a Beta distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
Regression class method beta()
Regression class method betaPlot()
Regression class method betaMinMax()
Regression class method betaMinMaxPlot()
Beta Function public static double betaFunction(double z , double w)
Regularised Incomplete Beta Function public static double regularisedBetaFunction(double z , double w, double x)
public static double regularizedBetaFunction(double z , double w, double x)
public static void resetCFmaxIter(int maxit)
public static int getCFmaxIter()
public static void resetCFtolerance(double tolerance)
public static double getCFtolerance()
Gamma Distribution and Gamma Functions Cumulative Distribution Function(cdf) public static double gammaCDF(double mu, double beta, double gamma, double limit)
public static double gammaCDF(double gamma, double limit)
Probability Density Function (pdf) public static double gammaPDF(double mu, double beta, double gamma, double x)
public static double gammaPDF(double gamma, double x)
Generate Gamma random deviates public static double[ ] gammaRand(double mu, double beta, double gamma, int n)
public static double[ ] gammaRand(double mu, double beta, double gamma, int n, long seed)
Mean public static double gammaMean(double mu, double beta, double gamma)
Mode public static double gammaMode(double mu, , double beta, double gamma,)
Standard deviation public static double gammaStandardDeviation(double beta, double gamma)
Fit data to a Gamma distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
Regression class method gamma()
Regression class method gammaPlot()
Regression class method gammaStandard()
Regression class method gammaStandardPlot()
Gamma Function public static double gammaFunction(double x)
Lanczos approximation settings public static double getLanczosGamma()
public static int getLanczosN()
public static double[] getLanczosCoeff()
log(Gamma Function) public static double logGammaFunction(double x)
Inverse Gamma Function public static double[] inverseGammaFunction(double gamma)
Regularised Incomplete Gamma Function public static double regularisedGammaFunction(double a, double x)
public static double regularizedGammaFunction(double a, double x)
Complementary Regularised Incomplete Gamma Function public static double complementaryRegularisedGammaFunction(double a, double x)
public static double complementaryRegularizedGammaFunction(double a, double x)
Incomplete Gamma Function approximation settings public static void setIncGammaMaxIter(int nmax)
public static int getIncGammaMaxIter()
public static void setIncGammaTol(double tol)
public static double getIncGammaTol()
Gamma Function Minimum public static double[] gammaFunctionMinimum()
Erlang Distribution and Erlang connections busy, B and C Equations Cumulative Distribution Function(cdf) public static double erlangCDF(double lambda, int kay, double limit)
public static double erlangCDF(double lambda, long kay, double limit)
public static double erlangCDF(double lambda, double kay, double limit)
Probability Density Function (pdf) public static double erlangPDF(double lambda, int kay, double x)
public static double erlangPDF(double lambda, long kay, double x)
public static double erlangPDF(double lambda, double kay, double x)
Generate Erlang random deviates public static double[ ] erlangRand(double lambda, int kay, int n)
public static double[ ] erlangRand(double lambda, long kay, int n)
public static double[ ] erlangRand(double lambda, double kay, int n)
public static double[ ] erlangRand(double lambda, int kay, int n, long seed)
public static double[ ] erlangRand(double lambda, long kay, int n, long seed)
public static double[ ] erlangRand(double lambda, double kay, int n, long seed)
Mean public static double erlangMean(double lambda, int kay)
public static double erlangMean(double lambda, long kay)
public static double erlangMean(double lambda, double kay)
Mode public static double erlangMode(double lambda, int kay)
public static double erlangMode(double lambda, long kay)
public static double erlangMode(double lambda, idouble kay)
Standard deviation public static double erlangStandardDeviation(double lambda, int kay)
public static double erlangStandardDeviation(double lambda, long kay)
public static double erlangStandardDeviation(double lambda, break kay)
Fit data to an Erlang distribution
public void fitOneOrSeveralDistributions()
public static void fitOneOrSeveralDistributions(double[] array)
Regression class method erlang()
Regression class method erlangPlot()
Erlang connections busy probability
public static double erlangMprobability(double totalTraffic, double totalResources, double em)
public static double erlangMprobability(double totalTraffic, long totalResourceslong em)
public static double erlangMprobability(double totalTraffic, int totalResourcesint em)
Erlang B Equation
public static double erlangBprobability(double totalTraffic, double totalResources)
public static double erlangBprobability(double totalTraffic, long totalResources)
public static double erlangBprobability(double totalTraffic, int totalResources)
public static double erlangBload(double blockingProbability, double totalResources)
public static double erlangBload(double blockingProbability, long totalResources)
public static double erlangBload(double blockingProbability, int totalResources)
public static double[] erlangBresources(double blockingProbability, double totalTraffic)
Erlang C Equation
public static double erlangCprobability(double totalTraffic, double totalResources)
public static double erlangCprobability(double totalTraffic, long totalResources)
public static double erlangCprobability(double totalTraffic, int totalResources)
public static double erlangCload(double nonZeroDelayProbability, double totalResources)
public static double erlangCload(double nonZeroDelayProbability, long totalResources)
public static double erlangCload(double nonZeroDelayProbability, int totalResources)
public static double[] erlangCresources(double nonZeroDelayProbability, double totalTraffic)
Engset Equation Engset probability public static double engsetProbability(double offeredTraffic, double totalResources, double numberOfSources)
public static double engsetProbability(double offeredTraffic, long totalResources, long numberOfSources)
public static double engsetProbability(double offeredTraffic, int totalResources, int numberOfSources)
Engset load public static double engsetLoad(double blockingProbability, double totalResources, double numberOfSources)
public static double engsetLoad(double blockingProbability, long totalResources, long numberOfSources)
public static double engsetLoad(double blockingProbability, int totalResources, int numberOfSources)
Engset resources public static double[] engsetResources(double blockingProbability, double offeredTraffic, double numberOfSources)
public static double[] engsetResources(double blockingProbability, double offeredTraffic, long numberOfSources)
public static double[] engsetResources(double blockingProbability, double offeredTraffic, int numberOfSources)
Engset number of sources public static double[] engsetSources(double blockingProbability, double offeredTraffic, double reources)
public static double[] engsetSources(double blockingProbability, double offeredTraffic, long resources)
public static double[] engsetSources(double blockingProbability, double offeredTraffic, int resources)
Chi-Square Distribution and Chi-Square Statistic Cumulative Distribution Function (cdf) public static double chiSquareCDF(double chiSquare, int nu)
Inverse Cumulative Distribution Function public static double chiSquareInverseCDF(int nu, double cdfProb)
Probability Density Function (pdf) public static double chiSquarePDF(double chiSquare, int nu)
Generate exponential random deviates public static double[ ] chiSquareRand(int nu, int n)
public static double[ ] chiSquareRand(int nu, int n, long seed)
Mean public static double chiSquareMean(int nu)
Mode public static double chiSquareMode(int nu)
Standard Deviation public static double chiSquareStandardDeviation(int nu)
Statistic public static double chiSquare(double[ ] observed, double[ ] expected, double[ ] variance)
public static double chiSquareFreq(int[ ] observedFreq, int[ ] expectedfreq)
public static double chiSquareFreq(double[ ] observedFreq, double[ ] expectedFreq)
Wilson-Hilferty Transform public static double wilsonHilferty(double chiSquare, int nu)
public static double wilsonHilferty(double reducedChiSquare, double variance)
F-Distribution Cumulative Distribution Function (cdf) [Complement]; public static double fCompCDF(double fValue, int nu1, int nu2)
public static double fCompCDF(double var1, int nu1, double var2, int nu2)
public static double fTestValueGivenFprob(double fProb, int nu1, int nu2)
Inverse Cumulative Distribution Function public static double fdistributionInverseCDF(int nu1, int nu2, double cdf)
Probability Density Function (pdf) ; public static double fPDF(double fValue, int nu1, int nu2)
public static double fPDF(double var1, int nu1, double var2, int nu2)
Generate F-distribution random deviates public static double[ ] fRand(int nu1, int nu2, int n)
public static double[ ] fRand(int nu1, int nu2, int n, long seed)
F-Distribution Order Statistic Medians
public static double[ ] fDistributionOrderStatisticMedians(int nu1, int nu2, int n)
F-Distribution Probability Plot
See separate class ProbabilityPlot F-Distribution Probability Plot methods
Fit data array to one or several distributions Instance method public void fitOneOrSeveralDistributions()
Static method public static void fitOneOrSeveralDistributions(double[] array)
Error Functions Error Function public static double erf(double x)
Complementary Error Function public static double erfc(double x)
Factorials Factorial public static int factorial(int n)
public static long factorial(long n)
public static BigInteger factorial(BigInteger n)
public static double factorial(double n)
public static BigDecimal factorial(BigDecimal n)
log(factorial) public static double logFactorial(int n)
public static double logFactorial(long n)
public static double logFactorial(double n)
Shannon Entropy
Instance methods
Shannon entropy as bits public double shannonEntropy()
public double shannonEntropyBit()
Shannon entropy as nats public double shannonEntropyNat()
Shannon entropy as dits public double shannonEntropyDit()
Shannon Entropy
Static methods
Shannon entropy as bits public static double shannonEntropy(double[] p)
public static double shannonEntropyBit(double[] p)
Shannon entropy as nats public static double shannonEntropyNat(double[] p)
Shannon entropy as dits public static double shannonEntropyDit(double[] p)
Binary Shannon entropy as bits public static double binaryShannonEntropy(double p)
public static double binaryShannonEntropyBit(double p)
Binary Shannon entropy as nats public static double binaryShannonEntropyNat(double p)
Binary Shannon entropy as dits public static double binaryShannonEntropyDit(double p)
Rényi Entropy
Instance methods
Rényi entropy as bits public double renyiEntropy(double alpha)
public double renyiEntropyBit(double alpha)
Rényi entropy as nats public double renyiEntropyNat(double alpha)
Rényi entropy as dits public double renyiEntropyDit(double alpha)
Rényi Entropy
Static methods
Rényi entropy as bits public static double renyiEntropy(double[] p, double alpha)
public static double renyiEntropyBit(double[] p, double alpha)
Rényi entropy as nats public static double renyiEntropyNat(double[] p, double alpha)
Rényi entropy as dits public static double renyiEntropyDit(double[] p, double alpha)
Tsallis Entropy
Instance method
Tsallis Entropy (as nats) public double tsallisEntropyNat(double q)
Tsallis Entropy
Static method
Tsallis Entropy (as nats) public static double tsallisEntropyNat(double[] p, double q)
A Generalized Entropy
Instance method
A Generalized Entropy (as nats) public double generalizedEntropyOneNat(double q, double r)
A Generalized Entropy
Static method
A Generalized Entropy (as nats) public static double generalizedEntropyOneNat(double[] p, double q, double r)
Histograms   public static double histogramBins(double[ ] data, double binWidth, double lowerLimit, double upperLimit)
public static double histogramBins(double[ ] data, double binWidth, double lowerLimit)
public static double histogramBins(double[ ] data, doublebinWidth)
public static double histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, double upperLimit)
public static double histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, double upperLimit, String xLegend)
public static double histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit)
public static double histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, String xLegend)
public static double histogramBinsPlot(double[ ] data, double binWidth)
public static double histogramBinsPlot(double[ ] data, double binWidth, String xLegend)
Outlier detection
Grubbs’ Test
Instant methods public ArrayList<Object> outlierGrubbs(double significance)
public ArrayList<Object> lowerOutlierGrubbs(double significance)
public ArrayList<Object> upperOutlierGrubbs(double significance)
Static methods public static ArrayList<Object> outlierGrubbs(double[] data, double significance)
public static ArrayList<Object> lowerOutlierGrubbs(double[] data, double significance)
public static ArrayList<Object> upperOutlierGrubbs(double[] data, double significance)
public static double getGrubbsOneSidedCriticalT(double significance, int nObservations)
public static double getGrubbsTwoSidedCriticalT(double significance, int nObservations)
Outlier detection
Anscombe Normalised Residual Test
Instant methods public ArrayList<Object> lowerOutliersAnscombe(double constant)
public ArrayList<Object> lowerOutliersAnscombe(BigDecimal constant)
public ArrayList<Object> lowerOutliersAnscombe(BigInteger constant)
public ArrayList<Object> upperOutliersAnscombe(double constant)
public ArrayList<Object> upperOutliersAnscombe(BigDecimal constant)
public ArrayList<Object> upperOutliersAnscombe(BigInteger constant)
Static methods public static Vector<Object> lowerOutliersAnscombe(double[ ] data, double constant)
public static Vector<Object> lowerOutliersAnscombeAsVector(double[ ] data, double constant)
public static ArrayList<Object> lowerOutliersAnscombeAsArrayList(double[ ] data, double constant)
public static Vector<Object> lowerOutliersAnscombe(double[ ] data, BigDecimal BigDecimal)
public static Vector<Object> lowerOutliersAnscombeAsVector(BigDecimal[ ] data, BigDecimal constant)
public static ArrayListt<Object> lowerOutliersAnscombeAsArrayList(BigDecimal[ ] data, BigDecimal constant)
public static Vector<Object> lowerOutliersAnscombe(double[ ] data, BigInteger BigInteger)
public static Vector<Object> lowerOutliersAnscombeAsVector(BigInteger[ ] data, BigInteger constant)
public static ArrayList<Object> lowerOutliersAnscombeAsArrayList(BigInteger[ ] data, BigInteger constant)
public static Vector<Object> upperOutliersAnscombe(double[ ] data, double constant)
public static Vector<Object> upperOutliersAnscombeAsVector(double[ ] data, double constant)
public static ArrayList<Object> upperOutliersAnscombeAsArrayList(double[ ] data, double constant)
public static Vector<Object> upperOutliersAnscombe(double[ ] data, BigDecimal BigDecimal)
public static Vector<Object> upperOutliersAnscombeAsVector(BigDecimal[ ] data, BigDecimal constant)
public static ArrayListt<Object> upperOutliersAnscombeAsArrayList(BigDecimal[ ] data, BigDecimal constant)
public static Vector<Object> upperOutliersAnscombe(double[ ] data, BigInteger BigInteger)
public static Vector<Object> upperOutliersAnscombeAsVector(BigInteger[ ] data, BigInteger constant)
public static ArrayList<Object> upperOutliersAnscombeAsArrayList(BigInteger[ ] data, BigInteger constant)

List and details of the instance methods inherited or overridden from the superclass ArrayMaths may be found on Inherited Methods



CONSTRUCTORS

public Stat(Vector<Object> array)
public Stat(ArrayList<Object> array)
public Stat(Object[] array)
public Stat(double[] array)
public Stat(Double[] array)
public Stat(float[] array)
public Stat(Float[] array)
public Stat(long[] array)
public Stat(Long[] array)
public Stat(int[] array)
public Stat(Integer[] array)
public Stat(short[] array)
public Stat(Short[] array)
public Stat(byte[] array)
public Stat(Byte[] array)
public Stat(BigDecimal[] array)
public Stat(BigInteger[] array)
public Stat(Complex[] array)
public Stat(Phasor[] array)
public Stat(char[] array)
public Stat(Character[] array)
public Stat(String[] array)

Usage:                      Stat st = new Stat(aa);



METHODS

See class Fmath for recasting arrays if the array argument below is not of the type that you require.

SAMPLE MEAN, MEDIAN, VARIANCE, STANDARD DEVIATION AND COEFFICIENT OF VARIATION

ENTER AN ARRAY OF WEIGHTS

public void setWeights(Vector<Object> array)
public void setWeights(ArrayList<Object> array)
public void setWeights(Object[] array)
public void setWeights(double[] array)
public void setWeights(Double[] array)
public void setWeights(float[] array)
public void setWeights(Float[] array)
public void setWeights(long[] array)
public void setWeights(Long[] array)
public void setWeights(int[] array)
public void setWeights(Integer[] array)
public void setWeights(short[] array)
public void setWeights(Short[] array)
public void setWeights(byte[] array)
public void setWeights(Byte[] array)
public void setWeights(BigDecimal[] array)
public void setWeights(BigInteger[] array)
public void setWeights(Complex[] array)
public void setWeights(Phasor[] array)
public void setWeights(char[] array)
public void setWeights(Character[] array)
public void setWeights(String[] array)

Usage:                      st.setWeights(aa);
If a weighted statistic is required, this method allows the array of weights to be entered as aa.
The array of weights aa, may be of type Vector<Object>, ArrayList<Object>, Object[ ], double[ ], Double[ ], float[ ], Float[ ], long[ ], Long[ ], int[ ], Integer[ ], short[ ], Short[ ], byte[ ], Byte[ ], BigDecimal[ ], BigInteger[ ], Complex[ ] or Phasor[ ].

If the array is entered as Vector<Object> ArrayList<Object> or Object[] the individual elements may be of mixed type. The types accepted: Double, Float, Long, Integer, Short, Byte, BigDecimal, BigInteger, Complex or Phasor.

All elements will be converted to the same type as the array of variables in st which may be double, BigDecimal or Complex.

The weights, in general, should be estimates of the uncertainty of the value, i.e. of the error or resolution of the value, entered via the constructor, was drawn. If you have calculated your weights as W where Wi is equivalent to this method's 1/(uncertaintyi2) you can use the method convertBigWtoLittleW() to convert your array of weights to values required by this method, i.e. from an array of Wi to an array of wi which equal 1/√Wi. See weighted arithmetic mean for a detailed example.

WEIGHTING CONVENTIONS
WEIGHTING FACTOR OPTIONS
Instance method
public void setWeightsToBigW()
public void setWeightsToLittleW()
public double[] converBigWtoLittleW()

Usage:                      st.setWeightsToBigW();
The default weighting option of this class is to treat the weights as the uncertainties in the observations, w. This method must be called if you want to change the default option and enter the weights as multiplicative weighting factors, W, e.g. to calculate the weighted mean as

The weighting option set by the static methods below applies to all instances created within the same application unless this or the following instance method is called. The instance methods of setting the weighting option do not alter the static setting of the option.

Usage:                      st.setWeightsToLittleW();
This method reinstates the default weighting option of this class, i.e. to treat the weights as the uncertainties in the observations, w, e.g. to calculate the weighted mean as

The option set by the static methods below applies to all instances created within the same application unless this or the above instance method is called. The instance methods of setting the weighting option do not alter the static setting of the option.

Usage:                      st.converBigWtoLittleW();
This method, which converts each weight to to 1/√weight, is deprecated. See above two methods for setting the weighting option.

Static method
public static void setStaticWeightsToBigW()
public static void setStaticWeightsToLittleW()
public static double[] converBigWtoLittleW(double[] bigW)
Usage:                      Stat.setStaticWeightsToBigW();
The default weighting option of this class is to treat the weights as the uncertainties in the observations, w. This method must be called if you want to change the default option and enter the weights as multiplicative weighting factors, W, e.g. to calculate the weighted mean as

The static methods for setting the weighting option also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.

Usage:                      Stat.setStaticWeightsToLittleW();
This method reinstates the default weighting option of this class, i.e. to treat the weights as the uncertainties in the observations, w, e.g. to calculate the weighted mean as

The static methods for setting the weighting option also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.

Usage:                      Stat.BigWtoLittleW(bigW);
This method, which converts each weight in the array, bigW, to to 1/√weight, is deprecated. See above two methods for setting the weighting option.

EFFECTIVE SAMPLE NUMBER (EFFECTIVE BASE)
Instance methods
Choosing to use the true sample number, n
public void useTrueN()
Usage:                      st.useTrueN();
Sets the sample number option to the use of the true sample number, n, e.g.

The default value is to use the default value nEff where

unless this has been reset by the static method, useStaticEffectiveN() (see below). The option set by the static methods below applies to all instances created within the same application unless this or the following instance method is called. The instance methods of setting the sample number do not alter the static setting of the option.

Choosing to use the effective sample number, n
public void useEffectiveN()
Usage:                      st.useEffectiveN();
Sets the sample number option to the use of the effective sample number, nEff,

e.g. the variance will now be calculated as

The effective sampmple number, nEff, is the default value and this method need only be called if the above method (set to n) or the static method, useStaticTrueN(), has already been called and a reset to nEff is required. The option set by the static methods below applies to all instances created within the same application unless this or the above instance method is called. The instance methods of setting the sample number do not alter the static setting of the option.

Static methods
Choosing to use the true sample number, n
public void setStaticTrueN()
Usage:                      Stat.setStaticTrueN();
Sets the sample number option to the use of the true sample number, n,, e.g.

The default option is to use the default value nEff where

The static methods for setting the sample number also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.

Choosing to use the effective sample number, nEff
public void useStaticEffectiveN()
Usage:                      Stat.useStaticEffectiveN();
Sets the sample number option to the use of the effective sample number, nEff,

e.g. the variance will now be calculated as

The default value is nEff. The static methods for setting the sample number also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.



MEANS AND WEIGHTED MEANS
Arithmetic Mean
Instance methods
public double mean_as_double()
public BigDecimal mean_as_BigDecimal()
public Complex mean_as_Complex()
Usage:                      mean = st.mean_as_xxx();
Returns the sample arithmetic mean

as type xxxx where xxxx may be double, BigDecimal or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double mean(double[] x)
public static float mean(float[] x)
public static double mean(int[] x)
public static double mean(long[] x)
public static double mean(short[] x)
public static double mean(byte[] x)
public static BigDecimal mean(BigDecimal[] x)
public static BigDecimal mean(BigInteger[] x)
public static Complex mean(Complex[] a)
Usage:                      mean = Stat.mean(x);
Returns the sample arithmetic mean

of the variables in the array of double, float, int, long, short, byte, BigDecimal, BigInteger or Complex, x. The means of the integers (int, long, short and byte) are returned as a double. The means of BigDecimal and BigInteger are returned as Bigdecimal.

Weighted Arithmetic Mean
Instance methods
public double weightedMean_as_double()
public BigDecimal weightedMean_as_BigDecimal()
public Complex weightedMean_as_Complex()
Usage:                      mean = st.weightedMean_as_xxx();
Returns the weighted arithmetic mean

as type xxxx where xxxx may be double, BigDecimal or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted arithmetic mean equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double mean(double[] x, double[] w)
public static float mean(float[] x, float[] w)
public static BigDecimal mean(BigDecimal[] x, BigDecimal[] w)
public static BigDecimal mean(BigInteger[] x, BigInteger[] w)
public static Complex mean(Complex[] x, Complex[] w)
Usage:   wmean = Stat.mean(x, w);
Returns the weighted arithmetic mean

of the variables in an array of double, float, BigDecimal, bigInteger or Complex, x, where the array, w, contains the weights for each point. Each weight, wi,should be an estimate of the uncertainty of xi. n is the number of data points (remember Java array indices start at zero).
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted arithmetic mean equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Subtract the Arithmetic Mean from an array
Instance methods
public double subtractMean_as_double()
public BigDecimal subtractMean_as_BigDecimal()
public Complex subtractMean_as_Complex()
Usage:                      xMinusMean = st.subtractMean_as_xxx();
Returns an array xMinusMean, of which each element is the corresponding element in the internal array of st minus the arithmetic mean of that array. The array is returned as type xxxx where xxxx may be double, BigDecimal or Complex. The array of variables should be entered via the Contructor.

Static methods
public static double[] subtractMean(double[] x)
public static float[] subtractMean(float[] x)
public static BigDecimal[] subtractMean(BigDecimal[] x)
public static BigDecimal[] subtractMean(BigInteger[] x)
public static Complex[] subtractMean(Complex[] x)
Usage:   xMinusMean = Stat.subtractMean(x);
Returns an array xMinusMean, of which each element is the corresponding element in the argument array, x, minus the arithmetic mean of the array x.

Subtract the Weighted Arithmetic Mean from an array
Instance methods
public double subtractWeightedMean_as_double()
public BigDecimal subtractWeightedMean_as_BigDecimal()
public Complex subtractWeightedMean_as_Complex()
Usage:                      xMinusMean = st.subtractWeightedMean_as_xxx();
Returns an array xMinusMean, of which each element is the corresponding element in the internal array of st minus the weighted arithmetic mean of that array. The array is returned as type xxxx where xxxx may be double, BigDecimal or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2) you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double[] subtractMean(double[] x, double[] w)
public static float[] subtractMean(float[] x, float[] w)
public static BigDecimal[] subtractMean(BigDecimal[] x, BigDecimal[] w)
public static BigDecimal[] subtractMean(BigInteger[] x, BigInteger[] w)
public static Complex[] subtractMean(Complex[] x, Complex[] w)
Usage:   xMinusMean = Stat.subtractMean(x, w);
Returns an array xMinusMean, of which each element is the corresponding element in the argument array, x, minus the weighted arithmetic mean of the array x. The weights are entered as the array w. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2) you must first set the appropriate weighting option to convert your array of weights to values required by this method. Geometric Mean
Instance methods
public double geometricMean_as_double()
public Complex geometricMean_as_Complex()
Usage:                      gmean = st.geometricMean_as_xxx();
Returns the geometric mean

as type xxxx where xxxx may be double or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double geometricMean(double[] x)
public static float geometricMean(float[] x)
public static Complex geometricMean(Complex[] x)
public static double geometricMean(BigDecimal[] x)
public static double geometricMean(BigInteger[] x)
Usage:                      gmean = Stat.geometricMean(x);
Returns the geometric mean

of the variables in the array of double, float, Complex, BigDecimal or BigInteger, x.

Weighted Geometric Mean
Instance methods
public double weightedGeometricMean_as_double()
public Complex weightedGeometricMean_as_Complex()
Usage:                      gmean = st.weightedGeometricMean_as_xxx();
Returns the weighted geometric mean

as type xxxx where xxxx may be double or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double geometricMean(double[] x, double[] w)
public static float geometricMean(float[] x, float[] w)
public static Complex geometricMean(Complex[] x, Complex[] w)
public static double geometricMean(BigDecimal[] x, BigDecimal[] w)
public static double geometricMean(BigInteger[] x, BigInteger[] w)
Usage:                      gmean = Stat.geometricMean(x, w);
Returns the weighted geometric mean

of the variables in the array of double, float, Complex, BigDecimal or BigInteger, x, where the array, w, contains the weights for each point. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method. n is the number of data points (remember Java array indices start at zero).

Harmonic Mean
Instance methods
public double harmonicMean_as_double()
public BigDecimal harmonicMean_as_BigDecimal()
public Complex harmonicMean_as_Complex()
Usage:                      hmean = st.harmonicMean_as_xxx();
Returns the harmonic mean

as type xxxx where xxxx may be double, bigDecimal or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double harmonicMean(double[] x)
public static float harmonicMean(float[] x)
public static BigDecimal harmonicMean(BigDecimal[] x)
public static BigDecimal harmonicMean(BigInteger[] x)
public static Complex harmonicMean(Complex[] x)
Usage:                      hmean = Stat.harmonicMean(x);
Returns the harmonic mean

of the variables in the array of double, float, BigDecimal, BigInteger or Complex, x.

Weighted Harmonic Mean
Instance methods
public double weightedHarmonicMean_as_double()
public BigDecimal weightedHarmonicMean_as_BigDecimal()
public Complex weightedHarmonicMean_as_Complex()
Usage:                      gmean = st.weightedHarmonicMean_as_xxx();
Returns the weighted harmonic mean

as type xxxx where xxxx may be double, bigDecimal Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double harmonicMean(double[] x, double[] w)
public static float harmonicMean(float[] x, float[] w)
public static BigDecimal harmonicMean(BigDecimal[] x, BigDecimal[] w)
public static BigDecimal harmonicMean(BigInteger[] x, BigInteger[] w)
public static Complex harmonicMean(Complex[] x, Complex[] w)
Usage:                      hmean = Stat.harmonicMean(x, w);
Returns the weighted harmonic mean

of the variables in the array of double, float, BigDecimal, BigInteger or Complex, x, where the array, w, contains the weights for each point. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method. n is the number of data points (remember Java array indices start at zero).

Generalized Mean (Power Mean)
Instance methods
public double generalizedMean_as_double(double m)
public double generalizedMean_as_double(BigDecimal m)
public Complex generalizedMean_as_Complex(double m)
public Complex generalizedMean_as_Complex(Complex m)
Usage:                      gmean = st.generalizedMean_as_xxx(m);
Usage:                      gmean = st.generalisedMean_as_xxx(m);
Returns the generalized mean (also known as the power mean)

as type xxxx where xxxx may be double or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor. Either spelling, generalized or genralised, may be used.

Static methods
public static double generalizedMean(double[] x, double m)
public static float generalizedMean(float[] x, float m)
public static double generalizedMean(BigDecimal[] x, double m)
public static double generalizedMean(BigDecimal[] x, BigDecimal m)
public static double generalizedMean(BigInteger[] x, double m)
public static double generalizedMean(BigInteger[] x, BigInteger m)
public static Complex generalizedMean(Complex[] x, double m)
public static Complex generalizedMean(Complex[] x, Complex m)
Usage:                      genmean = Stat.generalizedMean(x, m);
Usage:                      genmean = Stat.generalisedMean(x, m);
Returns the generalized mean (also known as the power mean)

of the variables in the array of double or float, x, for the power m. Either spelling, generalized or genralised, may be used.

Weighted Generalized Mean (Weighted Power Mean)
Instance methods
public double weightedGeneralizedMean_as_double(double m)
public double weightedGeneralizedMean_as_double(BigDecimal m)
public Complex weightedGeneralizedMean_as_Complex(double m)
public Complex weightedGeneralizedMean_as_Complex(Complex m)
Usage:                      wgmean = st.weightedGeneralizedMean_as_xxx(m);
Usage:                      wgmean = st.weightedGeneralisedMean_as_xxx(m);
Returns the weighted generalized mean (also known as the weighted power mean)

as type xxxx where xxxx may be double or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.
Either spelling, generalized or genralised, may be used.

Static methods
public static double generalizedMean(double[] x, double[] w, double m)
public static float generalizedMean(float[] x, float[] w, float m)
public static double generalizedMean(BigDecimal[] x, BigDecimal[] w, double m)
public static double generalizedMean(BigDecimal[] x, BigDecimal[] w, BigDecimal m)
public static double generalizedMean(BigInteger[] x, BigInteger[] w, double m)
public static double generalizedMean(BigInteger[] x, BigInteger[] w, BigInteger m)
public static Complex generalizedMean(Complex[] x, Complex[] w, double m)
public static Complex generalizedMean(Complex[] x, Complex[] w, Complex m)
Usage:                      wgenmean = Stat.generalizedMean(x, w, m);
Usage:                      wgenmean = Stat.generalisedMean(x, w, m);
Returns the weighted generalized mean (also known as the weighted power mean)

of the variables in the array of double or float, x, for the power m, weighted by the weights in the array, w. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Either spelling, generalized or genralised, may be used.

Interquartile Mean
Instance methods
public double interQuartileMean_as_double()
public BigDecimal interQuartileMean_as_BigDecimal()
Usage:                      hmean = st.interQuartileMean_as_xxx();
Returns the interquartile mean

as type xxxx where xxxx may be double or BigDecimal. The array should be entered via the Contructor as any of the types allowed by the constructor and may be in any order.

Static methods
public static double interQuartileMean(double[] x)
public static float interQuartileMean(float[] x)
public static BigDecimal interQuartileMean(BigDecimal[] x)
public static BigDecimal interQuartileMean(BigInteger[] x)
Usage:                      iqmean = Stat.interQuartileMean(x);
Returns the interquartile mean

of the variables in an ordered array, x. The elements of the entered array of double, float, BigDecimal or BigInteger x may be in any order, the method, interQuartileMean(x), first orders that array, x.

Root Mean Square (rms)
Instance methods
public double rms()
Usage:                      rms = st.rms();
Returns the root mean square (rms)

of the variables in the internal array of the instance, st. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double rms(double[] x)
public static float rms(float[] x)
public static double rms(BigDecimal[] x)
public static double rms(BigInteger[] x)
Usage:                      rms = Stat.rms(x);
Returns the root mean square (rms)

of the variables in the array, x.

Weighted Root Mean Square (wrms)
Instance methods
public double rms()
Usage:                      rms = st.weightedRms();
Returns the weighted root mean square (wrms)

of the variables in the internal array of the instance, st. The array should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double rms(double[] x, double[] w)
public static float rms(float[] x, float[] w)
public static double rms(BigDecimal[] x, BigDecimal[] w)
public static double rms(BigInteger[] x, BigInteger[] w)
Usage:                      rms = Stat.rms(x,w);
Returns the weighted root mean square (wrms)

of the variables in the array, x with the weights in the array, w. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. you are using the equation

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

MEDIAN
Instance methods
public double median_as_double()
public BigDecimal median_as_BigDecimal()
Usage:                      median = st.median_as_xxxx();
Returns the sample median of the variables in the internal array of the instance st. This method creates an array of the elements in the intenal array in st arranged ascending order and returns, if the length of the array is odd, the middle value, or if the length of the array is even, the average value of the two middle values. The median may be returned as the data type corresponding to xxx, i.e. as either double or BigDecimal. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double median(double[] x)
public static float median(float[] x)
public static double median(long[] x)
public static double median(int[] x)
public static BigDecimal median(BigDecimal[] x)
public static BigDecimal median(BigInteger[] x)
Usage:                      median = Stat.median(x);
Returns the sample median of the variables in the array of double, float, long, int, BigDecimal or BigInteger, x.
This method creates an array of the elements in the array, x, arranged ascending order and returns, if the length of the array is odd, the middle value, or if the length of the array is even, the average value of the two middle values.

SETTING THE DENOMINATOR
Instance methods
public void setDenominatorToN()
Usage:                      st.setDenominatorToN();
Sets the denominator of the variance, covariance, standard deviation, moment skewness, median skewness or kurtosis calculated for the instance st to the number of data points, n, e.g.

The default value is (n − 1) unless this has been reset by the static method, setStaticDenominatorToN() (see below). The option set by the static methods below applies to all instances created within the same application unless this or the following instance method is called. The instance methods of setting the denominator do not alter the static setting of the option.

public void setDenominatorToNminusOne()
Usage:                      st.setDenominatorToNminusOne();
Sets the denominator of the variance, covariance, standard deviation, moment skewness, median skewness or kurtosis calculated for the instance st to the number of data points minus one, (n − 1), e.g.

The is the default value and this method need only be called if the above method (set to n) or the static method, setStaticDenominatorToN(), has already been called and a reset to (n − 1) is required. The option set by the static methods below applies to all instances created within the same application unless this or the above instance method is called. The instance methods of setting the denominator do not alter the static setting of the option.

Static methods
public void setStaticDenominatorToN()
Usage:                      Stat.setStaticDenominatorToN();
Sets the denominator of the variance, covariance, standard deviation, moment skewness, median skewness or kurtosis calculated by the relevant Stat methods to the number of data points, n, e.g.

The default value is (n − 1). The static methods for setting the denominator also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.

public void setStaticDenominatorToNminusOne()
Usage:                      Stat.setStaticDenominatorToNminusOne();
Sets the denominator of the variance, covariance, standard deviation, moment skewness, median skewness or kurtosis calculated by the relevant Stat methods to the number of data points minus one, (n − 1), e.g.

The default value is (n − 1). The static methods for setting the denominator also set the default option for all instatiations within the same application. Instance resetting methods (above) may be called to reset the option for an individual instance.



VARIANCE AND WEIGHTED VARIANCE
Variance
Instance methods
public double variance_as_double()
public BigDecimal variance_as_BigDecimal()
public Complex variance_as_Complex()
public double variance_as_Complex_ConjugateCalcn()
public double variance_of_Complexmoduli()
public double variance_of_ComplexRealParts()
public double variance_of_ComplexImaginaryParts()
Usage:                      var = st.variance_as_xxx();
Returns the variance
or             
as type xxxx where xxxx may be double, BigDecimal or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.variance_as_Complex_ConjugateCalcn();
Returns the variance

as a double. The aterisk * indicates the complex cougate. The Complex array should be entered via the Contructor.
See immdiately above for the calculationof a complex variance using the standard variance formula. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.variance_of_ComplexModuli();
Returns the variance
or             
where the xi are the moduli of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.variance_of_ComplexRealParts();
Returns the variance
or             
where the xi are the real parts of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.variance_of_ComplexImaginaryParts();
Returns the variance
or             
where the xi are the imaginary parts of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Static methods
public static double variance(double[] x)
public static float variance(float[] x)
public static double variance(long[] x)
public static double variance(int[] x)
public static BigDecimal variance(BigDecimal[] x)
public static BigDecimal variance(Biginteger[] x)
public static Complex variance(Complex[] x)
public static double varianceConjugateCalcn(Complex[] x)
public static double varianceModuli(Complex[] x)
public static double varianceRealParts(Complex[] x)
public static double varianceImaginaryParts(Complex[] x)
Usage:                      var = Stat.variance(x);
Returns the sample variance of the n variables in the array of double, float, long, int, BigDecimal, BigInteger or Complex, x, where the variance is calculated as
or             
where n = x.length (Remember Java array indices start at zero).
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = Stat.varianceConjugateCalcn(x);
Returns the variance of the Complex array x using the conjugate formula in calculating the variance.
See Standard Deviation for the variance formulae options.
See immediately above for the use of the standard formula in calculating the variance of a complex array.

Usage:                      var = Stat.varianceModuli(x);
Returns the variance of the the moduli of the Complex array x.
See Standard Deviation for the variance formulae options.

Usage:                      var = Stat.varianceRealParts(x);
Returns the variance of the the real parts of the Complex array x.
See Standard Deviation for the variance formulae options.

Usage:                      var = Stat.varianceinaryImagParts(x);
Returns the variance of the the imaginary parts of the Complex array x.
See Standard Deviation for the variance formulae options.

Weighted variance
Instance methods
public double weightedVariance_as_double()
public BigDecimal weightedVariance_as_BigDecimal()
public Complex weightedVariance_as_Complex()
public double weightedVariance_as_Complex_ConjugateCalcn()
public double weightedVariance_as_ComplexModuli()
public double weightedVariance_as_ComplexRealParts()
public double weightedVariance_as_ComplexImaginaryParts()
Usage:                      var = st.weightedVariance_as_xxx();
Returns the weighted variance

as type xxxx where xxxx may be double, BigDecimal or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi.
The default sample number is nEff and the default denominator is (nEff−1). See Setting the denominator for methods resetting the denominator to nEff or n and see Effective sample number for resetting this to n.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted variance equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double variance(double[] x, double[] w)
public static float variance(float[] x, float[] w)
public static BigDecimal variance(BigDecimal[] x, BigDecimal[] w)
public static BigDecimal variance(BigInteger[] x, Biginteger[] w)
public static Complex variance(Complex[] x, Complex[] w)
public static double varianceModuli(Complex[] x, Complex[] w)
public static double varianceRealParts(Complex[] x, Complex[] w)
public static double varianceImaginaryParts(Complex[] x, Complex[] w)
Usage:                      var = Stat.variance(x, w);
Returns the sample weighted variance of the n variables in the array of double, float, BigDecimal, BigInteger or Complex, x, with weights, w, that should be estimates of the uncertainties of the data values, x. The variance is calculated as

where n = x.length (Remember Java array indices start at zero).
The default sample number is nEff and the default denominator is (nEff−1). See Setting the denominator for methods resetting the denominator to nEff or n and see Effective sample number for resetting this to n.
Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted variance equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

STANDARD DEVIATION, WEIGHTED STANDARD DEVIATION AND VOLATILITY
Standard deviation
Instance methods
public double standardDeviation_as_double()
public Complex standardDeviation_as_Complex()
public double standardDeviation_as_Complex_ConjugateCalcn()
public double standardDeviation_of_ComplexModuli()
public double standardDeviation_of_ComplexRealParts()
public double standardDeviation_of_ComplexImaginaryPartsParts()
Usage:                      var = st.standardDeviation_as_xxx();
Returns the standard deviation

as type xxxx where xxxx may be double or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.standardDeviation_as_Complex_ConjugateCalcn();
Returns the standard deviation

as a double. The aterisk * indicates the complex cougate. The Complex array should be entered via the Contructor.
See immdiately above for the calculationof a complex variance using the standard variance formula. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.standardDeviation_of_ComplexModuli();
Returns the standard deviation

where the xi are the moduli of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.standardDeviation_of_ComplexRealParts();
Returns the standard deviation

where the xi are the real parts of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      var = st.standardDeviation_of_ComplexImaginaryParts();
Returns the standard deviation

where the xi are the imaginary parts of an array of Complex. The Complex array should be entered via the Contructor. The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Static methods
public static double standardDeviation(double[] x)
public static float standardDeviation(float[] x)
public static double standardDeviation(long[] x)
public static double standardDeviation(int[] x)
public static double standardDeviation(BigDecimal[] x)
public static double standardDeviation(BigInteger[] x)
public static Complex standardDeviation(Complex[] x)
public static double standardDeviationConjugateCalcn(Complex[] x)
public static double standardDeviationModuli(Complex[] x)
public static double standardDeviationRealParts(Complex[] x)
public static double standardDeviationImaginaryParts(Complex[] x)
Usage:                      sd = Stat.standardDeviation(x);
Returns the sample standard deviation of the variables in the array of double, float, long, int, BigDecimal, BigInteger or Complex, x, where the standard deviation is calculated as the square root of the variance

and n = x.length (Remember Java array indices start at zero).
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Usage:                      sd = Stat.standardDeviationConjugateCalcn(x);
Returns the standard deviation of the mean of the Complex array Xusing the conjugate formula in calculating the standard deviation.
See Standard Deviation for the standard deviation formulae options.
See immediately above for the use of the standard formula in calculating the standard deviation of a complex array.

Usage:                      sd = Stat.standardDeviationModuli(x);
Returns the standard deviation of the mean of the the real moduli of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Usage:                      sd = Stat.standardDeviationRealParts(x);
Returns the standard deviation of the mean of the the real parts of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Usage:                      sd = Stat.standardDeviationinaryImagParts(x);
Returns the standard deviation of the mean of the the imaginary parts of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Weighted standard deviation
Instance methods
public double weightedStandardDeviation_as_double()
public Complex weightedStandardDeviation_as_Complex()
public double weightedStandardDeviation_as_Complex_ConjugateCalcn()
public double weightedStandardDeviation_as_ComplexModuli()
public double weightedStandardDeviation_as_ComplexRealParts()
public double weightedStandardDeviation_as_ComplexImaginaryParts()
Usage:                      var = st.weightedStandardDeviation_as_xxx();
Returns the weighted standard deviation

as type xxxx where xxxx may be double or Complex. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method.
The default sample number is nEff and the default denominator is (nEff−1). See Setting the denominator for methods resetting the denominator to nEff or n and see Effective sample number for resetting this to n.
Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted standard deviation equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double standardDeviation(double[] x, double[] w)
public static float standardDeviation(float[] x, float[] w)
public static double standardDeviation(BigDecimal[] x, BigDecimal[] w)
public static double standardDeviation(Biginteger[] x, BigInteger[] w)
public static Complex standardDeviation(Complex[] x, Complex[] w)
public static double standardDeviationModuli(Complex[] x, Complex[] w)
public static double standardDeviationRealParts(Complex[] x, Complex[] w)
public static double standardDeviationImaginaryParts(Complex[] x, Complex[] w)
Usage:                      sd = Stat.standardDeviation(x, w);
Returns the sample weighted standard deviation of the variables in the array of double, float, BigDecimal, BigInteger or Complex, x, with an array of weights, w, that should be estimates of the suncertainty of each measurement, x. The standard deviation is calculated as the square root of the weighted variance

and n = x.length (Remember Java array indices start at zero) Each weight, wi, should be an estimate of the uncertainty of the variable, xi, was drawn. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted standard deviation equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.
The default sample number is nEff and the default denominator is (nEff−1). See Setting the denominator for methods resetting the denominator to nEff or n and see Effective sample number for resetting this to n.


Log change volatility
Instance methods
public double volatilityLogChange()
Usage:                      volatility = st.volatilityLogChange();
Returns the log change volatility, i.e. the standard deviation of the natural base logarithms of the differences between successive values of the elements in the internal array of st, i.e. the standard deviation of loge(aai+1/aai) where aa are the internal array elements. The array should be entered via the Contructor as any of the types allowed by the constructor.

public double volatilityPerCentChange()
Usage:                      volatility = st.volatilityPerCentChange();
Returns the percentage change volatility, i.e. the standard deviation of the percentage differences 100(aai+1 - aai)/aai where aa are the internal array elements of st. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
public static double volatilityLogChange(double[] x)
public static float volatilityLogChange(float[] x)
public static double volatilityLogChange(BigDecimal[] x)
public static double volatilityLogChange(BigInteger[] x)
Usage:                      volatility = Stat.volatilityLogChange(x);
Returns the log change volatility, i.e. the standard deviation of the natural base logarithms of the differences between successive values of x, i.e. the standard deviation of loge(xi+1/xi). The array x may be double, float, BigDecimal or BigInteger.

Percentage change volatility
public static double volatilityPerCentChange(double[] x)
public static float volatilityPerCentChange(float[] x)
public static double volatilityPerCentChange(BigDecimal[] x)
public static double volatilityPerCentChange(BigInteger[] x)
Usage:                      volatility = Stat.volatilityPerCentChange(x);
Returns the percentage change volatility, i.e. the standard deviation of the percentage differences 100(xi+1 - xi)/xi. The array x may be double, float, BigDecimal, BigInteger.



STANDARD ERROR AND WEIGHTED STANDARD ERROR OF THE MEAN
Standard Error
Instance methods
public double standardError_as_double()
public Complex standardError_as_Complex()
public double standardError_as_Complex_ConjugateCalcn()
public double standardError_of_ComplexModuli()
public double standardError_of_ComplexRealParts()
public double standardError_of_ComplexImaginaryParts()
Usage:                      se = st.standardError_as_xxx();
Returns the standard error of the mean

of the internal array in the instance, st as type xxxx where xxxx may be double or Complex. The array should be entered via the Contructor

Usage:                      se = st.standardError_as_Complex_ConjugateCalcn();
Returns the standard error of the mean of the internal Complex array in the instance, st using the conjugate formula in calculating the standard deviation. The array should be entered via the Contructor.
See Standard Deviation for the standard deviation formulae options.
See immediately above for the use of the standard formula in calculating the standard error of a complex array.

Usage:                      se = st.standardError_of_ComplexModuli();
Returns the standard error of the mean of the the moduli of the internal Complex array in the instance, st. The array should be entered via the Contructor.
See Standard Deviation for the standard deviation formulae options.

Usage:                      se = st.standardError_of_ComplexRealParts();
Returns the standard error of the mean of the the real parts of the internal Complex array in the instance, st. The array should be entered via the Contructor.
See Standard Deviation for the standard deviation formulae options.

Usage:                      se = st.standardError_of_ComplexImaginaryParts();
Returns the standard error of the mean of the the imaginary parts of the internal Complex array in the instance, st. The array should be entered via the Contructor.
See Standard Deviation for the standard deviation formulae options.

Static methods
public static double standardError(double[] x)
public static float standardError(float[] x)
public static double standardError(long[] x)
public static double standardError(int[] x)
public static double standardError(BigDecimal[] x)
public static double standardError(BigInteger[] x)
public static Complex standardError(Complex[] x)
public static double standardErrorConjugateCalcn(Complex[] x)
public static double standardErrorModuli(Complex[] x)
public static double standardErrorRealParts(Complex[] x)
public static double standardErrorImaginaryParts(Complex[] x)
Usage:                      se = Stat.standardError(x);
Returns the standard error of the mean

of the array of double, float, long, int, BigDecimal, BigInteger or Complex, x. n is the length of the array.
See Standard Deviation for the standard deviation formulae options.

Usage:                      se = Stat.standardErrorConjugateCalcn(x);
Returns the standard error of the mean of the Complex array x using the conjugate formula in calculating the standard deviation.
See Standard Deviation for the standard deviation formulae options.
See immediately above for the use of the standard formula in calculating the standard error of a complex array.

Usage:                      se = Stat.standardErrorModuli(x);
Returns the standard error of the mean of the the moduli of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Usage:                      se = Stat.standardErrorRealParts(x);
Returns the standard error of the mean of the the real parts of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Usage:                      se = Stat.standardErrorinaryImagParts(x);
Returns the standard error of the mean of the the imaginary parts of the Complex array x.
See Standard Deviation for the standard deviation formulae options.

Weighted standard error
Instance methods
public double weightedStandardError_as_double()
public Complex weightedStandardError_as_Complex()
public double weightedStandardError_as_Complex_ConjugateCalcn()
public double weightedStandardError_as_ComplexModuli()
public double weightedStandardError_as_ComplexRealParts()
public double weightedStandardError_as_ComplexImaginaryParts()
Usage:                      se = st.weightedStandardError_as_xxx();
Returns the standard error of the weighted mean

of the internal array in the instance, st as type xxxx where xxxx may be double or Complex. The array should be entered via the Contructor as any of the types allowed by the constructor. n is the length of the array.
See Standard Deviation for the weighted standard deviation formulae options.
The default sample number is nEff. See Effective sample number for resetting this to n.
Each weight, wi, should be an estimate of the uncertainty of xi. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted standard error equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Static methods
public static double standardError(double[] x, double[] w)
public static float standardError(float[] x, float[] w)
public static double standardError(BigDecimal[] x, BigDecimal[] w)
public static double standardError(Biginteger[] x, BigInteger[] w)
public static Complex standardError(Complex[] x, Complex[] w)
public static double standardErrorModuli(Complex[] x, Complex[] w)
public static double standardErrorRealParts(Complex[] x, Complex[] w)
public static double standardErrorImaginaryParts(Complex[] x, Complex[] w)
Usage:                      se = Stat.standardError(x, w);
Returns the standard error of the weighted mean

of the variables in the array of double, float, BigDecimal, BigInteger or Complex, x, with an array of weights, w, that should be estimates of the uncertainty of each measurement, x. n is the length of the array.
See Standard Deviation for the weighted standard deviation formulae options.
The default sample number is nEff. See Effective sample number for resetting this to n.
Each weight, wi, should be an estimate of the uncertainty of xi. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted standard error equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.



COEFFICIENT OF VARIATION
Instance methods
Coefficient of variation
public double coefficientOfVariation()
Usage:                      coeffOfVar = st.coefficientOfVariation();
Returns the coefficient of variation

of the variables in the internal array of st. The array should be entered via the Contructor as any of the types allowed by the constructor.
See Standard Deviation for the standard deviation formulae options.

Weighted coefficient of variation
public double weightedCoefficientOfVariation()
Usage:                      coefofvar = st.volatilityPerCentChange();
Returns the weighted coefficient of variation

of the variables in the internal array of st. The array of variables should be entered via the Contructor as any of the types allowed by the constructor and the array of weights via the setWeights method. Each weight, wi, should be an estimate of the uncertainty of xi. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2) you must first set the appropriate weighting option to convert your array of weights to values required by this method.
See Standard Deviation for the standard deviation formulae options.

Static methods
Coefficient of variation
public static double coefficientOfVariation(double[] x)
public static float coefficientOfVariation(float[] x)
public static double coefficientOfVariation(BigDecimal[] x)
public static double coefficientOfVariation(BigInteger[] x)
Usage:                      coeffOfVar = Stat.coefficientOfVariation(x);
Returns the coefficient of variation

of the variables in the array of double, float, BigDecimal or BigInteger x.
See Standard Deviation for the standard deviation formulae options.

Weighted coefficient of variation
public static double coefficientOfVariation(double[] x, double[] w)
public static float coefficientOfVariation(float[] x, float[] w)
public static double coefficientOfVariation(BigDecimal[] x, BigDecimal[] w)
public static double coefficientOfVariation(BigInteger[] x, BigInteger[] w)
Usage:                      coeffOfVar = Stat.coefficientOfVariation(x, w);
Returns the weighted coefficient of variation

of the variables in the array of double, float, BigDecimal or BigInteger x and an array of weights, w, of matching type. Each weight, wi, should be an estimate of the uncertainty of xi.
If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2) you must first set the appropriate weighting option to convert your array of weights to values required by this method.
See Standard Deviation for the standard deviation formulae options.



SKEWNESS
Instance methods
Moment skewness
public double momentSkewness()
public double momentSkewness_as_double()
Usage:                      skewness = st.momentSkewness();
Usage:                      skewness = st.momentSkewness_as_double();
Returns, as a double, the moment skewness,

where xi are the elements of the internal array of st, is the sample mean and s is the sample standard deviation. The array should be entered via the Contructor as any of the types allowed by the constructor.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Median skewness (Pearson's median skewness coefficient)
public double medianSkewness()
public double medianSkewness_as_double()
Usage:                      skewness = st.medianSkewness();
Usage:                      skewness = st.medianSkewness_as_double();
Returns, as a double, Pearson's median skewness coefficient,

of the internal array of st. The array should be entered via the Contructor as any of the types allowed by the constructor.
See Standard Deviation for the standard deviation formulae options.

Quartile skewness (Bowley skewness coefficient)
public double quartileSkewness()
public double quartileSkewness_as_double()
public BigDecimal quartileSkewness_as_BigDecimal()
Usage:                      skewness = st.quartileSkewness();
Usage:                      skewness = st.quartileSkewness_as_double();
Usage:                      skewness = st.quartileSkewness_as_BigDecimal();
Returns, as a double or a BigDecimal, the quartile skewness (Bowley skewness coefficient),

where the Qs denote the interquartile ranges of the internal array of st. The array should be entered via the Contructor as any of the types allowed by the constructor.



Static methods
Moment skewness
public static double momentSkewness(double[] aa)
public static float momentSkewness(float[] aa)
public static double momentSkewness(BigDecimal[] aa)
public static double momentSkewness(BigInteger[] aa)
public static double momentSkewness(int[] aa)
public static double momentSkewness(long[] aa)
Usage:                      skewness = Stat.momentSkewness(aa);
Returns the moment skewness

where xi are the elements of the array aa, is the sample mean and s is the sample standard deviation. The array aa may be an array of double, float, BigDecimal, BigInteger, int or long. The skewness is returned as a double or float.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Median skewness (Pearson's median skewness coefficient)
public static double medianSkewness(double[] aa)
public static float medianSkewness(float[] aa)
public static double medianSkewness(BigDecimal[] aa)
public static double medianSkewness(BigInteger[] aa)
public static double medianSkewness(int[] aa)
public static double medianSkewness(long[] aa)
Usage:                      skewness = Stat.medianSkewness(aa);
Returns Pearson's median skewness coefficient

of the array aa. The array aa may be an array of double, float, BigDecimal, BigInteger, int or long. The skewness is returned as a double or float.
See Standard Deviation for the standard deviation formulae options.

Quartile skewness (Bowley skewness coefficient)
public static double quartileSkewness(double[] aa)
public static float quartileSkewness(float[] aa)
public static BigDecimal quartileSkewness(BigDecimal[] aa)
public static BigDecimal quartileSkewness(BigInteger[] aa)
public static double quartileSkewness(int[] aa)
public static double quartileSkewness(long[] aa)
Usage:                      skewness = Stat.medianSkewness(aa);
Returns the quartile skewness (Bowley skewness coefficient)

where the Qs denote the interquartile ranges of the array aa. The array aa may be an array of double, float, BigDecimal, BigInteger, int or long. The skewness is returned as a double, float or BigDecimal.



KURTOSIS (CURTOSIS)
Instance methods
Kurtosis
public double kurtosis()
public double kurtosis_as_double()
public BigDecimal kurtosis_as_BigDecimal()
Usage:                      kurtosis = st.kurtosis();
Usage:                      kurtosis = st.kurtosis_as_double();
Usage:                      kurtosis = st.kurtosis_as_BigDecimal();
Returns, as a double or a BigDecimal, the kurtosis,

where xi are the elements of the internal array of st, is the sample mean and s is the sample standard deviation. The array should be entered via the Contructor as any of the types allowed by the constructor.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Excess Kurtosis
public double excessKurtosis()
public double excessKurtosis_as_double()
public BigDecimal excessKurtosis_as_BigDecimal()
Usage:                      excess = st.excessKurtosis();
Usage:                      excess = st.excessKurtosis_as_double();
Usage:                      excess = st.excessKurtosis_as_BigDecimal();
Returns, as a double or a BigDecimal, the excess kurtosis,

where xi are the elements of the internal array of st, is the sample mean and s is the sample standard deviation, i.e. returns the kurtosis minus the kurtosis of a Gaussian distribution (3.0). The array should be entered via the Contructor as any of the types allowed by the constructor. kurtosisExcess may be used in place of excessKurtosis in the method names.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Static methods
Kurtosis
public static double kurtosis(double[] aa)
public static float kurtosis(float[] aa)
public static BigDecimal kurtosis(BigDecimal[] aa)
public static BigDecimal kurtosis(BigInteger[] aa)
public static double kurtosis(int[] aa)
public static double kurtosis(long[] aa)
Usage:                      kurtosis = Stat.kurtosis(aa);
Returns the kurtosis

where xi are the elements of the array aa, is the sample mean and s is the sample standard deviation. The array aa may be an array of double, float, BigDecimal, BigInteger, int or long. The kurosis is returned as a double, float or BigDecimal.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.

Excess Kurtosis
public static double excessKurtosis(double[] aa)
public static float excessKurtosis(float[] aa)
public static BigDecimal excessKurtosis(BigDecimal[] aa)
public static BigDecimal excessKurtosis(BigInteger[] aa)
public static double excessKurtosis(int[] aa)
public static double excessKurtosis(long[] aa)
Usage:                      excess = Stat.excessKurtosis(aa);
Returns the excess kurtosis

where xi are the elements of the array aa, is the sample mean and s is the sample standard deviation, i.e. returns the kurtosis minus the kurtosis of a Gaussian distribution (3.0). The array aa may be an array of double, float, BigDecimal, BigInteger, int or long. The excess kurosis is returned as a double, float or BigDecimal. kurtosisExcess may be used in place of excessKurtosis in the method names.
The default denominator is (n−1). See Setting the denominator for methods resetting the denominator.



STANDARDIZATION OF DATA TO A MEAN OF ZERO AND A STANDARD DEVIATION OF UNITY
Instance methods
Standardization of data
public double[] standardize()
Usage:                      standardizedData = st.standardize();
Returns, as an array of doubles, the variables in the internal array of st standardized to a mean of 0 and a standard deviation of 1, i.e. each internal data element, xi is transformed as

where is the mean and s is the standard deviation of the data before standardization. The array should be entered via the Contructor as any of the types allowed by the constructor.
The method standardise() performs the same function as the method standardize()

Static methods
Standardization of data
public static double[] standardize(double[] aa)
public static float[] standardize(float[] aa)
public static double[] standardize(BigDecimal[] aa)
public static double[] standardize(BigInteger[] aa)
public static double[] standardize(long[] aa)
public static double[] standardize(int[] aa)
Usage:                      standardizedData = Stat.standardize(aa);
Returns the variables in the array aa standardized to a mean of 0 and a standard deviation of 1, i.e. each element of the array aa, xi is transformed as

where is the mean and s is the standard deviation of aa before standardization. The variables in the array aa may be double, float, long, int, BigDecimal or BigInteger x. The standardized array is returned as an array of doubles or, in the case of aa entered as float, an array of float.
The method standardise(aa) performs the same function as the method standardize(aa).



SCALE DATA TO A NEW MEAN AND A NEW STANDARD DEVIATION
Instance methods
Scaling of data
public double[] scale(double mean, double sd)
Usage:                      scaledData = st.scale(mean, sd);
Returns, as an array of doubles, the variables in the internal array of st standardized to a new mean of mean and a new standard deviation of sd, i.e. each element of the internal array of st, xi is scales as

where and s1 are the mean and standard deviation of the internal array before scaling and and s2 are the required mean [mean] and standard deviation [sd]. The array should be entered via the Contructor as any of the types allowed by the constructor.

Static methods
Scaling of data
public static double[] scale(double[] aa, double mean, double sd)
public static float[] scale(float[] aa, float mean, float sd)
public static double[] scale(BigDecimal[] aa, double mean, double sd)
public static double[] scale(BigInteger[] aa, double mean, double sd)
public static double[] scale(long[] aa, double mean, double sd)
public static double[] scale(int[] aa, double mean, double sd)
Usage:                      scaledData = Stat.scale(aa, mean, sd);
Returns the variables in the array aa scaled to a new mean of mean and a new standard deviation of sd, i.e. each element of the array aa, xi is scales as

where and s1 are the mean and standard deviation of aa before scaling and and s2 are the required mean [mean] and standard deviation [sd]. The variables in the array aa may be double, float, long, int, BigDecimal or BigInteger x. The standardized array is returned as an array of doubles or, in the case of aa entered as float, an array of float.



LINEAR CORRELATION COEFFICIENT AND COVARIANCE (non-weighted and weighted)
Reference: Bevington, P.R. and Robinson, D.K. (2003) Data Reduction and Error Analysis for the Physical Sciences, McGraw Hill, 3rd Edition, pp 199-202 and 252-254
Unweighted Linear Correlation Coefficient - Non-binary data
public static double corrCoeff(double[ ] x, double[ ] y)
public static float corrCoeff(float[ ] x, float[ ] y)
public static double corrCoeff(int[ ] x, int[ ] y)
Usage:                     rCoeff = Stat.corrCoeff(x, y);
Returns the sample linear correlation coefficient, r, between two data arrays, x and y, in the above usage:



Weighted Linear Correlation Coefficient - Non-binary data
public static double corrCoeff(double[ ] x, double[ ] y, double[ ] w)
Usage:                     rCoeff = Stat.corrCoeff(x, y, w);
Returns the weighted sample linear correlation coefficient, r, between two data arrays, x and y, in the above usage, for weighted data, where the weights (estimates of the standard deviation of each x, y point, are provided in the array w in the above usage:

If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted correlation coefficient equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.

Unweighted Linear Correlation Coefficient - Binary data
All the above, e.g.
public static double corrCoeff(int[ ] x, int[ ] y)
may be used with the x and y arrays holding the binary data.
In addition the following methods are available for binary data:
public static double corrCoeff(int[ ][ ] freqMatrix)
public static double corrCoeff(int freqZeroZero, int freqZeroOne, int freqOneZero, int freqOneOne)
Usage:                     rCoeff = Stat.corrCoeff(x, y);
Returns the sample linear correlation coefficient between two data arrays, x and y, in the above usage, which may contain ones or zeros.
Usage:                     rCoeff = Stat.corrCoeff(freqMatrix);
Returns the linear correlation coefficient for binary data expressed as the frequency matrix

where

Usage:                     rCoeff = Stat.corrCoeff(freqZeroZero, freqZeroOne, freqOneZero, freqOneOne);
Returns the linear correlation coefficient for binary data expressed as the frequency matrix, shown immediately above, where

Weighted Linear Correlation Coefficient - Binary data
public static double corrCoeff(double[ ] x, double[ ] y, double[ ] w)
Usage:                     rCoeff = Stat.corrCoeff(x, y, w);
Returns the weighted linear correlation coefficient between two data arrays, x and y, in the above usage, for weighted data, where the weights (estimates of the standard deviation of each x, y point, are provided in the array w in the above usage. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2) you must first set the appropriate weighting option to convert your array of weights to values required by this method. For binary data the elements of arrays x and y will be 1.0 or 0.0

Cumulative Distribution Function
public static double corrCoeffCDF(double rCoeff, int nu)
Usage:                     p = Stat.corrCoeffCDF(rCoeff, nu);
Returns the probability, P(r), of observing a value of the correlation coefficient greater than r [rCoeff in the above usage] for a sample of N observations with ν degrees of freedom [nu in the above usage], where ν = N-2.

[Previously called Stat.linearCorrCoeffCDF(rCoeff, nu), which is still present in this class].

Probability Density Function (pdf)
public static double corrCoeffPDF(double rCoeff, int nu)
Usage:                     p = Stat.corrCoeffPDF(rCoeff, nu);
Returns the probability, p(r), that, for a completely uncorrelated parent population, any random sample of uncorrelated experimental data points will yield an experimental correlation coefficient equal to r [rCoeff in the above usage]. ν [nu in the above usage] are the degrees of freedom.

[Previously called Stat.linearCorrCoeff(rCoeff, nu), which is still present in this class].

COVARIANCE AND WEIGHTED COVARIANCE
Unweighted Covariance
public static double covariance(double[ ] x, double[ ] y)
public static float covariance(float[ ] x, float[ ] y)
public static double covariance(int[ ] x, int[ ] y)
Usage:                     cov = Stat.covariance(x, y);
Returns the covariance

of two data arrays, x and y, in the above usage.
The default denominator is (n−1). See
Setting the denominator for methods resetting the denominator.

Weighted Covariance
public static double covariance(double[ ] x, double[ ] y, double[ ] w)
Usage:                     cov = Stat.covariance(x, y, w);
Returns the weighted covariance

of two data arrays, x and y, in the above usage, for weighted data, where the weights (estimates of the standard deviation of each x, y point, are provided in the array w in the above usage. If you have calculated your weights as W where Wi is equivalent to this method's 1/(wi2), i.e. your weighted standard deviation equation is

you must first set the appropriate weighting option to convert your array of weights to values required by this method.
The default sample number is nEff and the default denominator is (nEff−1). See Setting the denominator for methods resetting the denominator to nEff or n and see Effective sample number for resetting this to n.



UNIFORM ORDER STATISTIC MEDIANS
public static double[] uniformOrderStatisticMedians(int n)
Usage:                      medians = Stat.uniformOrderStatisticMedians(n);
Returns the n uniform order statistic medians where
medians[0] = 1 - 0.51/n for n = 0
medians[i] = ((i+1) - 0.3175)/(n + 0.365) for i = 1, 2, 3, ..., n-2
medians[n-1] = 0.51/n for i = n-1

See individual distributions for that distribution's order statistic medians, e.g. see Gaussian (Normal) Distribution for Gaussian order statistic medians.


GAUSSIAN (NORMAL) DISTRIBUTION
Cumulative Distribution Function (cdf)
public static double gaussianCDF(double mean, double sd,double limit)
public static double gaussianCDF(double mean, double sd, double lowerlimit, double upperlimit)
public static double normalCDF(double mean, double sd,double limit)
public static double normalCDF(double mean, double sd, double lowerlimit, double upperlimit)
Usage:                      p = Stat.gaussianCDF(mean, sd, limit);
If the measurements of a variable, x, are distributed according to a Gaussian (normal) distribution around a mean of μ [argument double mean] with a standard deviation of σ [argument double sd] this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.gaussianCDF(mean, sd, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Gaussian (normal) distribution around a mean of μ [argument double mean] with a standard deviation of σ [argument double sd] this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.

The method normalCDF is identical to the method gaussianCDF

Inverse Cumulative Distribution Function
public static double gaussianInverseCDF(double mean, double sd,double pofz)
public static double normalInverseCDF(double mean, double sd, double pofz)
public static double gaussianInverseCDF(double pofz)
public static double normalInverseCDF(double pofz)
Usage:                      z = Stat.gaussianInverseCDF(mean, sd, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mean] and σ [sd] where these variables are related by the Gaussian cumulative distribution function


Usage:                      z = Stat.gaussianInverseCDF(pofz);
As above, with μ set to 0.0 and σ set to 1.0.

The methods normalInverseCDF, inverseNormalCDF and inverseGaussianCDF are identical to the method gaussianInverseCDF

Probability Density Function (pdf)
public static double gaussianPDF(double mean, double sd, double x)
public static double normalPDF(double mean, double sd, double x)
Usage:                      p = Stat.gaussianPDF(mean, sd, x);
Returns the Gaussian (normal) probabilty, p(x), where

and μ [argument double mean] and σ [argument double sd] are the mean and standard deviation of the Gaussian (normal) distribution.
The method normalPDF is identical to the method gaussianPDF

Generation of Gaussian [normal] random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] gaussianRand(double mean, double sd, int n)
public static double[ ] gaussianRand(double mean, double sd, int n, long seed)
public static double[ ] normalRand(double mean, double sd, int n)
public static double[ ] normalRand(double mean, double sd, int n, long seed)
Usage:                      deviates = Stat.gaussianRand(mean, sd, n);
Returns an array, of length n, of normal [Gaussian] random deviates from a normal [Gaussian] distribution of mean, mean, and standard deviation sd. The Java class, Random, is used as the source of individual standard Gaussian random deviates taking the initial seed from the clock.
Usage:                      deviates = Stat.gaussianRand(mean, sd, n, seed);
Returns an array, of length n, of normal [Gaussian] random deviates from a normal [Gaussian] distribution scaled to a mean, mean, and standard deviation sd. The Java class, Random, is used as the source of individual standard Gaussian random deviates with a user supplied initial seed, seed.
The method normalRand is identical to the method gaussianRand

Gaussian [Normal] Order Stastic Medians
public static double[] gaussianOrderStatisticMedians(double mean, double sd, int n)
public static double[] gaussianOrderStatisticMedians(int n)
public static double[] normalOrderStatisticMedians(double mean, double sd, int n)
public static double[] normalOrderStatisticMedians(int n)
Usage:                      medians = Stat.gaussianOrderStatisticMedians(mean, sd, n);
Returns, for a Gaussian distribution of mean, mean, and standard deviation, sd, the n Gaussian order statistic medians where
medians[i] = G−1(U[i])
G−1 is the inverse Gaussian cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Usage:                      medians = Stat.gaussianOrderStatisticMedians(n);
Returns, for a [0,1] Gaussian distribution, i.e. a Gaussian distribution of mean = 0 and standard deviation = 1, the n Gaussian order statistic medians where
medians[i] = G−1(U[i])
G−1 is the inverse Gaussian cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

The method normalOrderStatisticMedians is identical to the method gaussianOrderStatisticMedians

Gaussian [Normal] Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot

Fit data to a Gaussian [normal] distribution
Fitting data to the function

Box-Cox Transformation
See separate class BoxCox



LOG-NORMAL DISTRIBUTIONS
Both the two parameter and three parameter distributions are included in this class.

TWO PARAMETER LOG-NORMAL DISTRIBUTION
Cumulative Distribution Function (cdf)
public static double logNormalCDF(double mu, double sigma,double limit)
public static double logNormalTwoParCDF(double mu, double sigma,double limit)
public static double logNormalCDF(double mu, double sigma, double lowerlimit, double upperlimit)
public static double logNormalTwoParCDF(double mu, double sigma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.logNormalCDF(mu, sigma, limit);
If the measurements of a variable, x, are distributed according to a Two Parameter Log-Normal distribution with a location parameter μ [argument double mu] and a shape parameter σ [argument double sigma] this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.logNormalCDF(mu, sigma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Two Parameter Log-Normal distribution with a location parameter μ [argument double mu] and a shape parameter σ [argument double sigma] this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


The methods, logNormalTwoParCDF, are identical to the above methods, logNormalCDF.

Probability Density Function (pdf)
public static double logNormalPDF(double mu, double sigma, double x)
public static double logNormalTwoParPDF(double mu, double sigma, double x)
Usage:                      p = Stat.logNormalPDF(mu, sigma, x);
Returns the Two Parameter Log-Normal probabilty, p(x), where

and μ [argument double mu] and σ [argument double sigma] are the location and shape parameters of the Two Parameter Log-Normal distribution.

The method, logNormalTwoParPDF, is identical to the above method, logNormalPDF.

Mean
public static double logNormalMean(double mu, double sigma)
public static double logNormalTwoParMean(double mu, double sigma)
Usage:                      mean = Stat.logNormalMean(mu, sigma);
Returns the mean of a Two Parameter Log-Normal distribution,

where μ [argument double mu] is the location parameter and σ [argument double sigma] is the shape parameter.

The method, logNormalTwoParMean, is identical to the above method, logNormalMean.

Median
public static double logNormalMedian(double mu)
public static double logNormalTwoParMedian(double mu)
Usage:                      median = Stat.logNormalMedian(mu);
Returns the median of a Two Parameter Log-Normal distribution,

where μ [argument double mu] is the location parameter.

The method, logNormalTwoParMedian, is identical to the above method, logNormalMedian.

Mode
public static double logNormalMode(double mu, double sigma)
public static double logNormalTwoParMode(double mu, double sigma)
Usage:                      sd = Stat.logNormalMode(mu, sigma);
Returns the mode, i.e. the x value at which the Two Parameter Log-Normal distribution is at a maximum,

where μ [argument double mu] is the location parameter and σ [argument double sigma] is the shape parameter.

The method, logNormalTwoParMode, is identical to the above method, logNormalMode.

Standard Deviation
public static double logNormalStandardDeviation(double mu, double sigma)
public static double logNormalTwoParStandardDeviation(double mu, double sigma)
Usage:                      sd = Stat.logNormalStandardDeviation(mu, sigma);
Returns the standard deviation of a Two Parameter Log-Normal distribution,

where μ [argument double mu] is the location parameter and σ [argument double sigma] is the shape parameter.

The method, logNormalTwoParStandardDeviation, is identical to the above method, logNormalStanDev.

Generation of Two Parameter Log-Normal distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] logNormalRand(double mu, double sigma, int n)
public static double[ ] logNormalTwoParRand(double mu, double sigma, int n)
public static double[ ] logNormalRand(double mu, double sigma, int n, long seed)
public static double[ ] logNormalTwoParRand(double mu, double sigma, int n, long seed)
Usage:                      deviates = Stat.logNormalRand(mu, sigma, n);
Returns an array, of length n, of Two Parameter Log-Normal distribution random deviates from a Two Parameter Log-Normal distribution of location parameter, μ, [mu] and shape parameter, &sigma [sigma]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the log-normal random deviates.
Usage:                      deviates = Stat.logNormalRand(mu, sigma, n, seed);
Returns an array, of length n, of Two Parameter Log-Normal distribution random deviates from a Two Parameter Log-Normal distribution of location parameter, μ, [mu] and scale parameter, &sigma [sigma]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the log-normal random deviates.

The methods, logNormalTwoParRand, are identical to the above methods, logNormalRand.

Fit data to a Two Parameter Log-Normal Distribution
Fitting data to the function




THREE PARAMETER LOG-NORMAL DISTRIBUTION
The three parameter log-normal distribution, described by the equation

reduces to the two parameter log-normal distribution, descibed above, when α is set to zero, β is equated to σ and the μ is equated to log(γ).

Cumulative Distribution Function (cdf)
public static double logNormalThreeParCDF(double alpha, double beta, double gamma, double limit)
public static double logNormalThreeParCDF(double alpha, double beta, double gamma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.logNormalThreeParCDF(alpha, beta, gamma, limit);
If the measurements of a variable, x, are distributed according to a Three Parameter Log-Normal distribution with a location parameter α [argument double alpha], a shape parameter β [argument double beta] and a scale parameter γ [argument double gamma] this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.logNormalThreeParCDF(alpha, beta, gamma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Three Parameter Log-Normal distribution with a location parameter α [argument double alpha], a shape parameter β [argument double beta] and a scale parameter γ [argument double gamma] this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Probability Density Function (pdf)
public static double logNormalThreeParPDF(double alpha, double beta, double gamma, double x)
Usage:                      p = Stat.logNormalThreeParPDF(alpha, beta, gamma, x);
Returns the Three Parameter Log-Normal probabilty, p(x), where

and α [argument double alpha], β [argument double beta] and γ [argument double gamma] are the location, shape and scale parameters of the Three Parameter Log-Normal distribution.

Generation of Three Parameter Log-Normal distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] logNormalThreeParRanddouble alpha, double beta, double gamma, int n)
public static double[ ] logNormalThreeParRand(double alpha, double beta, double gamma, int n, long seed)
Usage:                      deviates = Stat.logNormalThreeParRand(alpha, beta, gamma, n);
Returns an array, of length n, of Three Parameter Log-Normal distribution random deviates from a Three Parameter Log-Normal distribution of location parameter, α, [alpha], shape parameter, β, [beta] and scale parameter, γ [gamma]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the log-normal random deviates.
Usage:                      deviates = Stat.logNormalThreeParRand(alpha, beta, gamma, n, seed);
Returns an array, of length n, of a Three Parameter Log-Normal distribution random deviates from a Three Parameter Log-Normal distribution of location parameter, α, [alpha], shape parameter, β, [beta] and scale parameter, γ [gamma]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the log-normal random deviates.

Mean
public static double logNormalThreeParMean(double alpha, double beta, double gamma)
Usage:                      mean = Stat.logNormalThreeParMean(alpha,beta, gamma);
Returns the mean of a Three Parameter Log-Normal distribution,

where α [argument double alpha], is the location parameter, β [argument double beta] is the shape parameter and γ [argument double gamma] is the scale parameter.

Median
public static double logNormalThreeParMedian(double alpha double gamma)
Usage:                      median = Stat.logNormalThreeParMedian(alpha, gamma);
Returns the median of a Three Parameter Log-Normal distribution,

where α [argument double alpha], is the location parameter and γ [argument double gamma] is the scale parameter.

Mode
public static double logNormalThreeParMode(double alpha, double beta, double gamma)
Usage:                      sd = Stat.logNormalThreeParMode(alpha,beta, gamma);
Returns the mode, i.e. the x value at which the Three Parameter Log-Normal distribution is at a maximum,

where α [argument double alpha], is the location parameter, β [argument double beta] is the shape parameter and γ [argument double gamma] is the scale parameter.

Standard Deviation
public static double logNormalThreeParStandardDeviation(double alpha, double beta, double gamma)
Usage:                      sd = Stat.logNormalThreeParStandardDeviation(alpha,beta, gamma);
Returns the standard deviation of a Three Parameter Log-Normal distribution,

where α [argument double alpha], is the location parameter, β [argument double beta] is the shape parameter and γ [argument double gamma] is the scale parameter.

Fit data to a Three Parameter Log-Normal Distribution
Fitting data to the function




LOGISTIC DISTRIBUTION
Sometimes referred to as the sech square distribution or the sech squared distribution
Cumulative Distribution Function (cdf)
public static double logisticCDF(double mu, double beta,double limit)
public static double logisticCDF(double mu, double beta, double lowerlimit, double upperlimit)
Usage:                      p = Stat.logisticCDF(mu, beta, limit);
If the measurements of a variable, x, are distributed according to a Logistic distribution with a location parameter μ [argument double mu] and a scale parameter β [argument double beta] this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.logisticCDF(mu, beta, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Logistic distribution with a location parameter μ [argument double mu] and a scale parameter β [argument double beta] this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double logisticMinInverseCDF(double mu, double beta, double cdf)
Usage:                      z = Stat.logisticInverseCDF(mu, beta, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu] and β [beta] where these variables are related by the Logistic cumulative distribution function


Probability Density Function (pdf)
public static double logisticPDF(double mu, double beta, double x)
Usage:                      p = Stat.logisticPDF(mu, beta, x);
Returns the Logistic probabilty, p(x), where

and μ [argument double mu] and β [argument double beta] are the location and scale parameters of the Logistic distribution.

Logistic Order Stastic Medians
public static double[ ] logisticOrderStatisticMedians(double mu, double beta, int n)
Usage:                      losm = Stat.logisticOrderStatisticMedians(mu, beta, n);
Returns, for a Logistic distribution of parameters μ [mu] and β, [beta], the n Logistic order statistic medians where
losm[i] = L−1(U[i])
L−1 is the inverse logistic cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double logisticMean(double mu)
Usage:                      mean = Stat.logisticMean(mu);
Returns the mean of a logistic distribution, mean = μ where
μ [argument double mu] is the location parameter.

Median
public static double logisticMedian(double mu)
Usage:                      median = Stat.logisticMedian(mu);
Returns the median of a Logistic distribution, median = μ, where
μ [argument double mu] is the location parameter.

Mode
public static double logisticMode(double mu)
Usage:                      sd = Stat.logisticMode(mu);
Returns the mode, i.e. the x value at which the Logistic distribution is at a maximum, mode = μ, where
μ [argument double mu] is the location parameter.

Standard Deviation
public static double logisticStandardDeviation(double beta)
Usage:                      sd = Stat.logisticStandardDeviation(beta);
Returns the standard deviation of a Logistic distribution, where

and β [argument double beta] is the scale parameter.

Generation of Logistic distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] logisticRand(double mu, double beta, int n)
public static double[ ] logisticRand(double mu, double beta, int n, long seed)
Usage:                      deviates = Stat.logisticRand(mu, beta, n);
Returns an array, of length n, of Logistic distribution random deviates from a Logistic distribution of location parameter, μ, [mu] and scale parameter, &beta [beta]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the logistic random deviates.
Usage:                      deviates = Stat.logisticRand(mu, beta, n, seed);
Returns an array, of length n, of Logistic distribution random deviates from a Logistic distribution of location parameter, μ, [mu] and scale parameter, &beta [beta]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the logistic random deviates.


Fit data to a Logistic Distribution
Fitting data to the function




POISSON DISTRIBUTION
Cumulative Distribution Function (cdf)
public static double poissonCDF(int k, double mean)
Usage:                     p = Stat.poissonCDF(k, mean);
Returns the probabilty that a number of Poisson random events will occur between 0 and k (inclusive) where k is an integer greater than or equal to 1. The argument, mean, is the mean of the Poisson distribution.

Probability Density Function (pdf)
public static double poissonPDF(int k, double mean)
Usage:                     p = Stat.poissonPDF(k, mean);
Returns the Poisson probabilty, p(k), where:

and k is an integer, greater than or equal to zero, and μ [argument double mean] is the mean of the Poisson distribution.

Generation of Poisson random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] poissonRand(double mean, int n)
public static double[ ] poissonRand(double mean, int n, long seed)
Usage:                      deviates = Stat.poissonRand(mean, n);
Returns an array, of length n, of Poisson random deviates from a Poisson distribution of mean, mean. The Java class, Random, is used as the source of required uniform random deviates taking the initial seed from the clock.
Usage:                      deviates = Stat.poissonRand(mean, n, seed);
Returns an array, of length n, of Poisson random deviates from a Poisson distribution of mean, mean. The Java class, Random, is used as the source of required uniform random deviates with a user supplied initial seed, seed.

Fit data to a Poisson Distribution
Fitting data to the function

Use the Regression class.
Arrange the data is in the form of an k and a p(k) data set, e.g. kdata and pdata, and use the constructor:
                      Regression reg = new Regression(kdata, pdata)
or
                      Regression reg = new Regression(kdata, pdata, weight)

Then use either the method:
                      reg.poissonPlot()
or
                      reg.poisson()

See Regression class for details of these constructors and methods and for the methods by which the results may be accessed.



LORENTZIAN DISTRIBUTION (CAUCHY DISTRIBUTION)
Cumulative Distribution Function (cdf)
public static double lorentzianCDF(double mu, double gamma,double limit)
public static double lorentzianCDF(double mu, double gamma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.lorentzianCDF(mu, gamma, limit);
If the measurements of a variable, x, are distributed according to a lorentzian distribution around a mean of μ [argument double mu] with a width at half maximum height of Γ [argument double gamma] this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.lorentzianCDF(mu, gamma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a lorentzian distribution around a mean of μ [argument double mu] with a width at half maximum height of Γ [argument double gamma] this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double lorentzianInverseCDF(double mu, double gamma, double cdf)
Usage:                      z = Stat.lorentzianInverseCDF(mu, gamma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu] and Γ [gamma] where these variables are related by the Lorentzian cumulative distribution function


Probability Density Function (pdf)
public static double lorentzianPDF(double mu, double gamma, double x)
Usage:                      p = Stat.lorentzianPDF(mu, gamma, x);
Returns the lorentzian probabilty, p(x), where

and μ [argument double mu] and Γ [argument double gamma] are the mean and width at half maximum height of the Lorentzian distribution.

Generation of Lorentzian random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] lorentzRand(double mu, double gamma, int n)
public static double[ ] lorentzRand(double mu, double gamma, int n, long seed)
Usage:                      deviates = Stat.lorentzianRand(mu, gamma, n);
Returns an array, of length n, of Lorentzian random deviates from a Lorentzian distribution of mean, mu and half-height width, Γ. The Java class, Random, is used as the source of required uniform random deviates taking the initial seed from the clock.
Usage:                      deviates = Stat.lorentzianRand(mu, gamma, n, seed);
Returns an array, of length n, of Lorentzian random deviates from a Lorentzian distribution of mean, mu and half-height width, Γ. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.


Lorentzian Order Stastic Medians
public static double[ ] lorentzianOrderStatisticMedians(double mu, double gamma, int n)
Usage:                      lorosm = Stat.lorentzianOrderStatisticMedians(mu, gamma, n);
Returns, for a Lorentzian distribution of parameters μ [mu] and Γ [gamma], the n Lorentzian order statistic medians where
lorosm[i] = L−1(U[i])
L−1 is the inverse Lorentzian cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Fit data to a Lorenztian Distribution
Fitting data to the function




GUMBEL DISTRIBUTION (MINIMUM ORDER STATISTIC) [TYPE 1 EXTREME VALUE DISTRIBUTION (MINIMUM ORDER STATISTIC)]
Cumulative Distribution Function (cdf)
public static double gumbelMinCDF(double mu, double sigma, double limit)
public static double gumbelMinCDF(double mu, double sigma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.gumbelMinCDF(mu, sigma, limit);
If the measurements of a variable, x, are distributed according to a Gumbel distribution (minimum order statistic), with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.gumbelMinCDF(mu, sigma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Gumbel distribution (minimum order statistic), with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double gumbelMinInverseCDF(double mu, double sigma, double cdf)
Usage:                      z = Stat.gumbelMinInverseCDF(mu, sigma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu] and σ [sigma] where these variables are related by the Gumbel [minimum order statistic] cumulative distribution function


Probability Density Function (pdf)
public static double gumbelMinPDF(double mu, double sigma, double x)
Usage:                      p = Stat.gumbelMinPDF(mu, sigma, x);
Returns the Gumbel probabilty (minimum order statistic), p(x), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Generation of Gumbel (minimum order statistic) random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] gumbelMinRand(double mu, double sigma, int n)
public static double[ ] gumbelMinRand(double mu, double sigma, int n, long seed)
Usage:                      deviates = Stat.gumbelMinRand(mu, sigma, n);
Returns an array, of length n, of Gumbel random deviates from a Gumbel distribution (minimum order statistic) of location parameter, mu and scale parameter, σ. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.gumbelMinRand(mu, sigma, n, seed);
Returns an array, of length n, of Gumbel random deviates from a Gumbel distribution (minimum order statistic) of location parameter, mu and scale parameter, σ. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Gumbel (maximum order statistic) Order Stastic Medians
public static double[ ] gumbelMinOrderStatisticMedians(double mu, double sigma, int n)
Usage:                      guosm = Stat.gumbelMinOrderStatisticMedians(mu, sigma, n);
Returns, for a Gumbel (minimum order statistic) distribution of parameters μ [mu] and σ, [sigma], the n Gumbel (minimum order statistic) order statistic medians where
guosm[i] = G−1(U[i])
G−1 is the inverse Gumbel (minimum order statistic) cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double gumbelMinMean(double mu, double gamma)
Usage:                      mean = Stat.gumbelMinMean(mu, sigma);
Returns the mean of a Gumbel distribution (minimum order statistic), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Median
public static double gumbelMinMedian(double mu, double sigma)
Usage:                      median = Stat.gumbelMinMedian(mu, sigma);
Returns the median of a mimimum Gumbel distribution, where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Mode
public static double gumbelMinMode(double mu, double sigma)
Usage:                      mode = Stat.gumbelMinMode(mu, sigma);
Returns the mode, i.e. the x value at which the Gumbel distribution (minimum order statistic) is at a maximum, where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Standard Deviation
public static double gumbelMinStandardDeviation(double sigma)
Usage:                      sd = Stat.gumbelMinStandardDeviation(sigma);
Returns the standard deviation of a Gumbel distribution (minimum order statistic), where

and σ [argument double sigma] is the scale parameter.

Fit data to a Gumbel Distribution (minimum order statistic)



GUMBEL DISTRIBUTION (MAXIMUM ORDER STATISTIC) [TYPE 1 EXTREME VALUE DISTRIBUTION (MAXIMUM ORDER STATISTIC)]
Cumulative Distribution Function (cdf)
public static double gumbelMaxCDF(double mu, double sigma, double limit)
public static double gumbelMaxCDF(double mu, double sigma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.gumbelMaxCDF(mu, sigma, limit);
If the measurements of a variable, x, are distributed according to a Gumbel distribution (maximum order statistic), with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.gumbelMaxCDF(mu, sigma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Gumbel distribution (maximum order statistic), with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double gumbelMaxInverseCDF(double mu, double sigma, double cdf)
Usage:                      z = Stat.gumbelMaxInverseCDF(mu, sigma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu] and σ [sigma] where these variables are related by the Gumbel [maximum order statistic] cumulative distribution function


Probability Density Function (pdf)
public static double gumbelMaxPDF(double mu, double sigma, double x)
Usage:                      p = Stat.gumbelMaxPDF(mu, sigma, x);
Returns the Gumbel Distribution (maximum order statistic) probabilty, p(x), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Generation of Gumbel (maximum order statistic) random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] gumbelMaxRand(double mu, double sigma, int n)
public static double[ ] gumbelMaxRand(double mu, double sigma, int n, long seed)
Usage:                      deviates = Stat.gumbelMaxRand(mu, sigma, n);
Returns an array, of length n, of Gumbel random deviates from a Gumbel distribution (maximum order statistic) of location parameter, μ and scale parameter, σ. The Java class, Random, is used as the source of necessary uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.gumbelMaxRand(mu, sigma, n, seed);
Returns an array, of length n, of Gumbel random deviates from a Gumbel distribution (maximum order statistic) of location parameter, μ and scale parameter, σ. The Java class, Random, is used as the source of necessary uniform random deviates with a user supplied seed, seed.

Gumbel (maximum order statistic) Order Stastic Medians
public static double[ ] gumbelMaxOrderStatisticMedians(double mu, double sigma, int n)
Usage:                      guosm = Stat.gumbelMaxOrderStatisticMedians(mu, sigma, n);
Returns, for a Gumbel (maximum order statistic) distribution of parameters μ [mu] and σ, [sigma], the n Gumbel (maximum order statistic) order statistic medians where
guosm[i] = G−1(U[i])
G−1 is the inverse Gumbel (maximum order statistic) cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double gumbelMaxMean(double mu, double gamma)
Usage:                      mean = Stat.gumbelMaxMean(mu, sigma);
Returns the mean of a Gumbel distribution (maximum order statistic), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Median
public static double gumbelMaxMedian(double mu, double sigma)
Usage:                      median = Stat.gumbelMaxMedian(mu, sigma);
Returns the median of a Gumbel distribution (maximum order statistic), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Mode
public static double gumbelMaxMode(double mu, double sigma)
Usage:                      mode = Stat.gumbelMaxMode(mu, sigma);
Returns the mode, i.e. the x value at which the Gumbel distribution (maximum order statistic) is at a maximum, where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Standard Deviation
public static double gumbelMaxStandardDeviation(double sigma)
Usage:                      sd = Stat.gumbelMaxStandardDeviation(sigma);
Returns the standard deviation of a Gumbel distribution (maximum order statistic), where

and σ [argument double sigma] is the scale parameter.

Fit data to a Gumbel Function (maximum order statistic)



FRÉCHET DISTRIBUTION [TYPE 2 EXTREME VALUE DISTRIBUTION]
Cumulative Distribution Function (cdf)
public static double frechetCDF(double mu, double sigma, double gamma, double limit)
public static double frechetCDF(double mu, double sigma, double gamma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.frechetCDF(mu, sigma, gamma, limit);
If the measurements of a variable, x, are distributed according to a Fréchet distribution, with a location parameter μ [argument double mu], a scale parameter σ [argument double sigma] and a shape parameter γ [argument double gamma], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.frechetCDF(mu, sigma, gamma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Fréchet distribution, with a location parameter μ [argument double mu], a scale parameter σ [argument double sigma] and a shape parameter γ [argument double gamma], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double frechetInverseCDF(double mu, double sigma, double gamma, double cdf)
public static double frechetInverseCDF(double sigma, double gamma, double cdf)
public static double frechetInverseCDF(double gamma, double cdf)
Usage:                      z = Stat.frechetInverseCDF(mu, sigma, gamma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu], σ [sigma] and γ [gamma] where these variables are related by the Fréchet cumulative distribution function


Usage:                      z = Stat.frechetInverseCDF(sigma, gamma, pofz);
As above with μ set to 0.0.

Usage:                      z = Stat.frechetInverseCDF(gamma, pofz);
As above with μ set to 0.0 and σ set to 1.0.

Probability Density Function (pdf)
public static double frechetPDF(double mu, double sigma, double gamma, double x)
Usage:                      p = Stat.frechetPDF(mu, sigma, gamma, x);
Returns the frechet probabilty, p(x), where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Generation of Fréchet random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] frechetRand(double mu, double sigma, double gamma, int n)
public static double[ ] frechetRand(double mu, double sigma, double gamma, int n, long seed)
Usage:                      deviates = Stat.frechetRand(mu, sigma, gamma, n);
Returns an array, of length n, of Fréchet random deviates from a Fréchet distribution of location parameter, mu, scale parameter, σ and shape parameter, γ. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.frechetRand(mu, sigma, gamma, n, seed);
Returns an array, of length n, of Fréchet random deviates from a Fréchet distribution of location parameter, mu, scale parameter, σ and shape parameter, γ. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Fréchet Order Stastic Medians
public static double[ ] frechetOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double sigma, double gamma, int n)
public static double[ ] frechetOrderStatisticMedians(double gamma, int n)
Usage:                      frosm = Stat.frechetOrderStatisticMedians(mu, sigma, gamma, n);
Returns, for a Fréchet distribution of parameters μ [mu], σ, [sigma], and γ, [gamma], the n Fréchet order statistic medians where
frosm[i] = F−1(U[i])
F−1 is the inverse Fréchet cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Usage:                      wosm = Stat.frechetOrderStatisticMedians(sigma, gamma, n);
As above with μ set to 0.0

Usage:                      wosm = Stat.frechetOrderStatisticMedians(gamma, n);
As above with μ set to 0.0 and σ set to 1.0

Mean
public static double frechetMean(double mu, double sigma, double gamma)
Usage:                      mean = Stat.frechetMean(mu, sigma, gamma);
Returns the mean of a Fréchet distribution, where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Mode
public static double frechetMode(double mu, double sigma, double gamma)
Usage:                      sd = Stat.frechetMode(mu, sigma, gamma);
Returns the mode, i.e. the x value at which the Fréchet distribution is at a maximum, where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Standard Deviation
public static double frechetStandardDeviation(double sigma, double gamma)
Usage:                      sd = Stat.frechetStandardDeviation(sigma, gamma);
Returns the standard deviation of a Fréchet distribution, where

and σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Fit data to a Fréchet Function



WEIBULL DISTRIBUTION [TYPE 3 EXTREME VALUE DISTRIBUTION]
Cumulative Distribution Function (cdf)
public static double weibullCDF(double mu, double sigma, double gamma, double limit)
public static double weibullCDF(double mu, double sigma, double gamma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.weibullCDF(mu, sigma, gamma, limit);
If the measurements of a variable, x, are distributed according to a Weibull distribution, with a location parameter μ [argument double mu], a scale parameter σ [argument double sigma] and a shape parameter γ [argument double gamma], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.weibullCDF(mu, sigma, gamma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Weibull distribution, with a location parameter μ [argument double mu], a scale parameter σ [argument double sigma] and a shape parameter γ [argument double gamma], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double weibullInverseCDF(double mu, double sigma, double gamma, double pofz)
public static double weibullInverseCDF(double sigma, double gamma, double pofz)
public static double weibullInverseCDF(double gamma, double pofz)
Usage:                      z = Stat.weibullInverseCDF(mu, sigma, gamma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu], σ [sigma] and γ [gamma] where these variables are related by the Weibull cumulative distribution function


Usage:                      z = Stat.weibullInverseCDF(sigma, gamma, pofz);
Returns the value of z [z] for a given P(z) [pofz], σ [sigma] and γ [gamma] where these variables are related by the Weibull cumulative distribution function


Usage:                      z = Stat.weibullInverseCDF(gamma, pofz);
Returns the value of z [z] for a given P(z) [pofz] and γ [gamma] where these variables are related by the Weibull cumulative distribution function


Probability Density Function (pdf)
public static double weibullPDF(double mu, double sigma, double gamma, double x)
Usage:                      p = Stat.weibullPDF(mu, sigma, gamma, x);
Returns the weibull probabilty, p(x), where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Generation of Weibull random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] weibullRand(double mu, double sigma, double gamma, int n)
public static double[ ] weibullRand(double mu, double sigma, double gamma, int n, long seed)
Usage:                      deviates = Stat.weibullRand(mu, sigma, gamma, n);
Returns an array, of length n, of Weibull random deviates from a Weibull distribution of location parameter, mu, scale parameter, σ and shape parameter, γ. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.weibullRand(mu, sigma, gamma, n, seed);
Returns an array, of length n, of Weibull random deviates from a Weibull distribution of location parameter, mu, scale parameter, σ and shape parameter, γ. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Weibull Order Stastic Medians
public static double[] weibullOrderStatisticMedians(double mu, double sigma, double gamma, int n)
public static double[] weibullOrderStatisticMedians(double sigma, double gamma, int n)
public static double[] weibullOrderStatisticMedians(double gamma, int n)
Usage:                      wosm = Stat.weibullOrderStatisticMedians(mu, sigma, gamma, n);
Returns, for a Weibull distribution of parameters μ [mu], σ, [sigma] and γ [gamma], the n Weibull order statistic medians where
wosm[i] = W−1(U[i])
W−1 is the inverse Weibull cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Usage:                      wosm = Stat.weibullOrderStatisticMedians(sigma, gamma, n);
As above with μ set to 0.0

Usage:                      wosm = Stat.weibullOrderStatisticMedians(gamma, n);
As above with μ set to 0.0 and σ set to 1.0

Mean
public static double weibullMean(double mu, double sigma, double gamma)
Usage:                      mean = Stat.weibullMean(mu, sigma, gamma);
Returns the mean of a Weibull distribution, where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Median
public static double weibullMedian(double mu, double sigma, double gamma)
Usage:                      median = Stat.weibullMedian(mu, sigma, gamma);
Returns the median of a Weibull distribution, where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Mode
public static double weibullMode(double mu, double sigma, double gamma)
Usage:                      mode = Stat.weibullMode(mu, sigma, gamma);
Returns the mode, i.e. the x value at which the Weibull distribution is at a maximum, where

and μ [argument double mu] is the location parameter, σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Standard Deviation
public static double weibullStandardDeviation(double sigma, double gamma)
Usage:                      sd = Stat.weibullStandardDeviation(sigma, gamma);
Returns the standard deviation of a Weibull distribution, where

and σ [argument double sigma] is the scale parameter and γ [argument double gamma] is the shape parameter.

Weibull Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot

Fit data to a Weibull Distribution




EXPONENTIAL DISTRIBUTION
The Exponential Distribution is a special case of the Type Three Extreme Value Distribution [Weibull Distribution] with the shape parameter, γ in the above equations, set to unity.
Cumulative Distribution Function (cdf)
public static double exponentialCDF(double mu, double sigma, double limit)
public static double exponentialCDF(double mu, double sigma, double lowerlimit, double upperlimit)
Usage:                      p = Stat.exponentialCDF(mu, sigma, limit);
If the measurements of a variable, x, are distributed according to a Exponential distribution, with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.exponentialCDF(mu, sigma, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Exponential distribution, with a location parameter μ [argument double mu] and a scale parameter σ [argument double sigma], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double exponentialInverseCDF(double mu, double sigma, double pofz)
Usage:                      z = Stat.exponentialInverseCDF(mu, sigma, pofz);
Returns the value of z [z] for a given P(z) [pofz], μ [mu] and σ [sigma] where these variables are related by the Exponential cumulative distribution function


Probability Density Function (pdf)
public static double exponentialPDF(double mu, double sigma, double x)
Usage:                      p = Stat.exponentialPDF(mu, sigma, x);
Returns the exponential probabilty, p(x), where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Generation of Exponential random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] exponentialRand(double mu, double sigma, int n)
public static double[ ] exponentialRand(double mu, double sigma, int n, long seed)
Usage:                      deviates = Stat.exponentialRand(mu, sigma, n);
Returns an array, of length n, of Exponential random deviates from a Exponential distribution of location parameter, mu, and scale parameter, σ. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.exponentialRand(mu, sigma, n, seed);
Returns an array, of length n, of Exponential random deviates from a Exponential distribution of location parameter, mu, and scale parameter, σ. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Exponential Order Stastic Medians
public static double[] exponentialOrderStatisticMedians(double mu, double sigma, int n)
Usage:                      eosm = Stat.exponentialOrderStatisticMedians(mu, sigma, n);
Returns, for an Exponential distribution of parameters μ [mu] and σ, [sigma], the n Exponential order statistic medians where
eosm[i] = E−1(U[i])
E−1 is the inverse Exponential cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double exponentialMean(double mu, double sigma)
Usage:                      mean = Stat.exponentialMean(mu, sigma);
Returns the mean of a Exponential distribution, where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Median
public static double exponentialMedian(double mu, double sigma)
Usage:                      mean = Stat.exponentialMedian(mu, sigma);
Returns the median of a Exponential distribution, where

and μ [argument double mu] is the location parameter and σ [argument double sigma] is the scale parameter.

Mode
public static double exponentialMode(double mu)
Usage:                      mode = Stat.exponentialMode(mu);
Returns the mode, i.e. the x value at which the Exponential distribution is at a maximum, where

and μ [argument double mu] is the location parameter.

Standard Deviation
public static double exponentialStandardDeviation(double sigma)
Usage:                      sd = Stat.exponentialStandardDeviation(sigma);
Returns the standard deviation of a Exponential distribution, where

and σ [argument double sigma] is the scale parameter.

Exponential Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot

Fit data to a Exponential Distribution



RAYLEIGH DISTRIBUTION
The Rayleigh Distribution is a special case of the Type Three Extreme Value Distribution [Weibull Distribution] with the shape parameter, γ in the above equations, set to equal 2, the location parameter, μ, set equal to zero and the Weibull scale pararameter divided by the square root of 2, i.e. β = σ/sqrt(2).
Cumulative Distribution Function (cdf)
public static double rayleighCDF(double beta, double limit)
public static double rayleighCDF(double beta, double lowerlimit, double upperlimit)
Usage:                      p = Stat.rayleighCDF(beta, limit);
If the measurements of a variable, x, are distributed according to a Rayleigh distribution, with a scale parameter β [argument double beta], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.rayleighCDF(beta, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Rayleigh distribution, with a scale parameter β [argument double beta], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double rayleighInverseCDF(double beta, double pofz)
Usage:                      z = Stat.rayleighInverseCDF(beta, pofz);
Returns the value of z [z] for a given P(z) [pofz] and β [beta] where these variables are related by the Rayleigh cumulative distribution function


Probability Density Function (pdf)
public static double rayleighPDF(double beta, double x)
Usage:                      p = Stat.rayleighPDF(beta, x);
Returns the rayleigh probabilty, p(x), where

and β [argument double beta] is the scale parameter.

Generation of Rayleigh random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] rayleighRand(double beta, int n)
public static double[ ] rayleighRand(double beta, int n, long seed)
Usage:                      deviates = Stat.rayleighRand(beta, n);
Returns an array, of length n, of Rayleigh random deviates from a Rayleigh distribution of scale parameter, β. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.rayleighRand(beta, n, seed);
Returns an array, of length n, of Rayleigh random deviates from a Rayleigh distribution of scale parameter, β. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Rayleigh Order Stastic Medians
public static double[] rayleighOrderStatisticMedians(double beta, int n)
Usage:                      rosm = Stat.rayleighOrderStatisticMedians(beta, n);
Returns, for a Rayleigh distribution of parameter β [beta], the n Rayleigh order statistic medians where
rosm[i] = R−1(U[i])
R−1 is the inverse Rayleigh cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double rayleighMean(double beta)
Usage:                      mean = Stat.rayleighMean(beta);
Returns the mean of a Rayleigh distribution, where

and β [argument double beta] is the scale parameter.

Median
public static double rayleighMedian(double beta)
Usage:                      median = Stat.rayleighMedian(beta);
Returns the median of a Rayleigh distribution, where

and β [argument double beta] is the scale parameter.

Mode
public static double rayleighMode(double beta)
Usage:                      mode = Stat.rayleighMode(beta);
Returns the mode, i.e. the x value at which the Rayleigh distribution is at a maximum, where

and μ [argument double mu] is the location parameter.

Standard Deviation
public static double rayleighStandardDeviation(double beta)
Usage:                      sd = Stat.rayleighStandardDeviation(beta);
Returns the standard deviation of a Rayleigh distribution, where

and β [argument double beta] is the scale parameter.

Rayleigh Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot

Fit data to a Rayleigh Distribution



TWO PARAMETER PARETO DISTRIBUTION
Cumulative Distribution Function (cdf)
public static double paretoCDF(double alpha, double beta, double limit)
public static double paretoCDF(double alpha, double beta, double lowerlimit, double upperlimit)
Usage:                      p = Stat.paretoCDF(alpha, beta, limit);
If the measurements of a variable, x, are distributed according to a Two Parameter Pareto distribution, with a shape parameter α [argument double alpha] and a scale parameter β [argument double beta], this method returns the probability, P(z), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

Usage:                      p = Stat.paretoCDF(alpha, beta, lowerlimit, upperlimit);
If the measurements of a variable, x, are distributed according to a Two Parameter Pareto distribution, with a shape parameter α [argument double alpha] and a scale parameter β [argument double beta], this method returns the probability, P(a,b), of observing a value of x in a random sample measurement which lies between a value, a, [argument double lowerlimit] and a value, b [argument double upperlimit], i.e.


Inverse Cumulative Distribution Function
public static double paretoInverseCDF(double alpha, double beta, double pofz)
Usage:                      z = Stat.paretoInverseCDF(alpha, beta, pofz);
Returns the value of z [z] for a given P(z) [pofz], α [alpha] and β [beta] where these variables are related by the Pareto cumulative distribution function


Probability Density Function (pdf)
public static double paretoPDF(double alpha, double beta, double x)
Usage:                      p = Stat.paretoPDF(alpha, beta, x);
Returns the Two Parameter Pareto probabilty, p(x), where

α [argument double alpha] is the shape parameter and β [argument double beta] is the scale parameter.

Generation of Pareto random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] paretoRand(double alpha, double beta, int n)
public static double[ ] paretoRand(double alpha, double beta, int n, long seed)
Usage:                      deviates = Stat.paretoRand(alpha, beta, n);
Returns an array, of length n, of Two Parameter Pareto random deviates from a Pareto distribution of shape parameter, α, and scale parameter, β. The Java class, Random, is used as the source of required uniform random deviates taking the seed from the clock.

Usage:                      deviates = Stat.paretoRand(alpha, beta, n, seed);
Returns an array, of length n, of Two Parameter Pareto random deviates from a Pareto distribution of shape parameter, α, and scale parameter, β. The Java class, Random, is used as the source of required uniform random deviates with a user supplied seed, seed.

Pareto Order Stastic Medians
public static double[] paretoOrderStatisticMedians(double alpha, double beta, int n)
Usage:                      posm = Stat.paretoOrderStatisticMedians(alpha, beta, n);
Returns, for a Pareto distribution of parameters α [alpha] and β [beta], the n Pareto order statistic medians where
posm[i] = P−1(U[i])
P−1 is the inverse Pareto cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

Mean
public static double paretoMean(double alpha, double beta)
Usage:                      mean = Stat.paretoMean(alpha, beta);
Returns the mean of a Two Parameter Pareto distribution, where

α [argument double alpha] is the shape parameter and β [argument double beta] is the scale parameter.

Mode
public static double paretoMode(double beta)
Usage:                      sd = Stat.paretoMode(beta);
Returns the mode, i.e. the x value at which the Two Parameter Pareto distribution is at a maximum, where

and β [argument double beta] is the scale parameter.

Standard Deviation
public static double paretoStandardDeviation(double alpha, double beta)
Usage:                      sd = Stat.paretoStandardDeviation(alpha, beta);
Returns the standard deviation of a Two Parameter Pareto distribution, where

α [argument double alpha] is the shape parameter and β [argument double beta] is the scale parameter.

Pareto Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot

Fit data to a Pareto Distribution



BINOMIAL DISTRIBUTION
Cumulative Binomial Probability
public static double binomalCDF(double p, int n, int k)
Usage:                      bp = Stat.binomalCDF(p, n, k);
Returns the cumulative binomial probability, P, of an event, which occurs with a probability, p, occuring k or more times in n trials:

A regularised incomplete beta function is used to calculate P


Binomial Probability Mass Function
public static double binomialPDF(double p, int n, int k)
Usage:                      bpmf = Stat.binomialPDF(p, n, k);
Returns the binomial mass probability function, p(j|n,p), idefined as:

where j is the number of successes in n trials of a Bernoulli process with probability of success p.

Generation of Binomial random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public double[ ] binomialRand(double prob, int nTrials, int nArray)
public double[ ] binomialRand(double prob, int nTrials, int nArray, long seed)
Usage:                      deviates = Stat.binomialRand(prob, nTrials, nArray);
Returns an array, of length nArray, of integer random deviates (returned as an array of doubles) drawn from a Binomial distribution of n [nTrials] each of probabilty p [prob].
The Java class, Random, is used, as the source of the generator's required standard uniform random deviates, taking the initial seed from the clock.

Usage:                      deviates = Stat.binomialRand(prob, nTrials, nArray, seed);
Returns an array, of length nArray, of integer random deviates (returned as an array of doubles) drawn from a Binomial distribution of n [nTrials] each of probabilty p [prob].
The Java class, Random, is used, as the source of the generator's required standard uniform random deviates, using a user supplied seed.

Binomial Coefficient
public static double binomialCoeff(int n, int k)
Usage:                      bc = Stat.binomialCoeff(n, k);
Returns the binomial coefficient, n!/(k!(n-k)!), for 0<=k<=n, as a double.
If a series of related binomial coefficients are required the recurrence relationships
coeff(n+1, k) = coeff(n, k)*(n+1)/(n-k+1) = coeff(n, k) + coeff(n, k-1)
coeff(n, k+1) = coeff(n, k)*(n-k)/(k+1)
may be useful.



STUDENT'S t-DISTRIBUTION
Cumulative distribution function (cdf)
public static double studentstCDF(double tValue, int nu)
public static double studentstCDF(double lowerLimit, double upperLimit, int nu)
Usage:                     p = Stat.studentstCDF(tValue, nu);
This method returns the cumulative distribution function

μ is the population mean and n is the number of measurements, Γ is the gamma function and IBeta is the regularised incomplete beta function.
The t value is passed to the method as tValue and the degrees of freedom, ν, are passed as nu.

Usage:                     p = Stat.studentstCDF(lowerLimit, upperLimit, nu);
This method returns the cumulative distribution function, P(a,b), where

and the symbols are defined immediately above. The lower limit, a, is passed as lowerLimit, the upper limit, b, is passed as upperLimit and the degrees of freedom, ν, are passed as nu.

P value
public static double pValue(double tValue, int nu)
Usage:                     pvalue = Stat.pValue(tValue, nu);
This method returns the P value

for a given Student's t value, t entered as tValue, ν degrees of freedom entered as nu.

Probability density function (pdf)
public static double studentstPDF(double tValue, int nu)
Usage:                     p = Stat.studentstPDF(tValue, nu);
This method returns the probabilty, p(t, ν)

The t value is passed to the method as tValue and the degrees of freedom, ν are passed as nu. The symbols have the same meaning as in the equations immediately above in the method studentstProb description.

Student’s t value for a given cumulative distribution function (cdf)
public static double studentstValue(double cdf, int nu)
Usage:                     t = Stat.studentstValue(cdf, nu);
This method returns the student’s t value for a given cumulative distribution function [cdf] and ν [nu] degrees of freedom.

Generation of Student's t random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] studentstRand(double nu, int n)
public static double[ ] studentstRand(double nu, int n, long seed)
Usage:                      deviates = Stat.studentstRand(nu, n);
Returns an array, of length n, of Student's t random deviates from a Student's t distribution of ν degrees of freedom, nu. The Java class, Random, is used as the source of necessary uniform random deviates. The Java class, Random, is used, as the source of the generator's required standard uniform random deviates, taking the initial seed from the clock.

Usage:                      deviates = Stat.studentstRand(nu, n, seed);
Returns an array, of length n, of Student's t random deviates from a Student's t distribution of ν degrees of freedom, nu. The Java class, Random, is used as the source of necessary uniform random deviates. The Java class, Random, is used, as the source of the generator's required standard uniform random deviates, using a user supplied seed.

Mean
public static double studentstMean(int nu)
Usage:                      mean = Stat.studentstMean(nu);
Returns the mean of a student's t-distribution where ν [argument int nu] is the number of degrees of freedom. The mean = 0 for ν>1 and is undefined for =1 [NaN returned].

Median
public static double studentstMedian()
Usage:                      median = Stat.studentstMean();
Returns the median of a student's t-distribution. The median = 0.

Mode
public static double studentstMode()
Usage:                      sd = Stat.studentstMode();
Returns the mode of a student's t-distribution. The mode = 0.

Standard Deviation
public static double studentstStandardDeviation(int nu)
Usage:                      sd = Stat.studentstStandardDeviation(nu);
Returns the standard deviation of a student's t-distribution where ν [argument int nu] is the number of degrees of freedom. The standard deviation, σ is given by


A(t|n) distribution
public static double probAtn(double tValue, int nu)
Usage:                     p = Stat.probAtn(tValue, nu);
Returns the probability, P, that a statistic, t, that measures the difference between means, would be smaller than the observed value (tValue in the above usage) if the means were in fact identical. nu are the degrees of freedom. The A(t|n) distribution probability P is calculated using a regularised incomplete beta function



CHI-SQUARE DISTRIBUTION AND STATISTIC
Chi Square Cumulative Distribtion Function (cdf)
public static double chiSquareCDF(double chiSquare, int nu)
Usage:                     p = Stat.chiSquareCDF(chiSquare, nu);
Returns the probability, P(x; ν), that an observed chi-square value, χ2, for a correct model should be less than the value in the argument, chiSquare, where

and ν [nu] is the number of degrees of freedom, Γ(ν/2) is the Gamma Function and IGamma(χ2/2, ν/2) is the Regularised Incomplete Gamma Function.

Inverse Cumulative Distribution Function
public static double chiSquareInverseCDF(int nu, double cfdProb)
Usage:                      chis = Stat.chiSquareInverseCDF(nu1, cdfProb);
Returns the value of χ2 [chis] for a given P(x,ν) [cdfProb] and ν [nu] where these variables are related by the Chi-Square cumulative distribution function


Chi Square Probability Density Function (pdf)
public static double chiSquarePDF(double chiSquare, int nu)
Usage:                     p = Stat.chiSquarePDF(chiSquare, nu);
Returns the chi-square probability, p(x; ν)

where ν [nu] is the number of degrees of freedom and Γ(ν/2) is the Gamma Function.

Generate chi-square random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] chiSquareRand(int nu, int n)
public static double[ ] chiSquareRand(int nu, int n, long seed)
Usage:                      deviates = Stat.chiSquareRand(nu, n);
Returns an array, of length n, of chi-square random deviates from a chi-square distribution of degree of freedom nu. The Java class, Random, is used as the source of individual uniform random deviates required in the calculation taking the initial seed from the clock.
Usage:                      deviates = Stat.chiSquareRand(nu1, nu2, n, seed);
Returns an array, of length n, of chi-square random deviates from an chi-square distribution of degree of freedom nu. The Java class, Random, is used as the source of individual uniform random deviates required in the calculation with a user supplied initial seed, seed.

Mean
public static double chiSquareMean(int nu)
Usage:                      mean = Stat.chiSquareMean(nu);
Returns the mean, ν, of a chi-square distribution where ν [argument double nu] is the number of degrees of freedom.

Mode
public static double chiSquareMode(int nu)
Usage:                      mean = Stat.chiSquareMean(nu);
Returns the mode, ν-2 (ν>=2), of a chi-square distribution where ν [argument double nu] is the number of degrees of freedom.

Standard Deviation
public static double chiSquareStandardDeviation(int nu)
Usage:                      mean = Stat.chiSquareStandardDeviation(nu);
Returns the standard deviation, the square root of 2ν, of a chi-square distribution where ν [argument double nu] is the number of degrees of freedom.

Chi Square Statistic
public static double chiSquare(double[ ] observed, double[ ] expected, double[ ] variance)
Usage:                     cs = Stat.chiSquare(observed, expected, variance);
Calculates and returns the chi square statistic

where the array observed holds the observed values, the array expected holds the expected values, variance holds the variances and n is the length of the arrays.

public static double chiSquareFreq(int[ ] observedfreq, int[ ] expectedFreq)
public static double chiSquareFreq(double[ ] observedfreq, double[ ] expectedFreq)
Usage:                     cs = Stat.chiSquareFreq(observedFreq, expectedFreq);
Calculates and returns the chi square statistic

where the array observedFreq holds the observed frequency of a values occuring with the ith bin, the array expectedFreq holds the corresponding expected frequency values and n is the length of the arrays. Computationally, the arrays may be int or double but, mathematically, the must conatain the frequencies of a value occuring with the ith bin. The distribution within each bin must be Poissonian.

Wilson-Hilferty Transform
public static double wilsonHilferty(double chiSquare, int nu)
public static double wilsonHilferty(double reducedChiSquare, double variance)
Usage:                     t = Stat.wilsonHilferty(chiSquare, nu);
This method performs a Wilson-Hilferty transformation

on a chi-square variable, χ2 [chiSquare], with ν [nu] degrees of freedom returning an approximation to a normal standardised value, W(χ2) [t].

Usage:                     t = Stat.wilsonHilferty(reducedChiSquare, reducedChiSquareVariance);
This method performs a Wilson-Hilferty transformation

on a reduced chi-square variable, χ2ν [reducedChiSquare], with a variance s2 [reducedChiSquareVariance] returning an approximation to a normal standardised value, W(χ2ν) [t].



F-DISTRIBUTION
Complement of the Cumulative Distribution Function (cdf)
public static double fCompCDF(double fValue, int nu1, int nu2)
public static double fCompCDF(double var1, int nu1, double var2, int nu2)
Usage:                     q = Stat.fCompCDF(fValue, nu1, nu2);
Returns the probability, Q, that a ratio of observed reduced chi-squares, F = (χ12/ν1)/(χ22/ν2) (fValue in the above usage), would be as large as it is if the denominator distribution with observed χ12/ν1 actually has a smaller reduced chi-square than that of the denominator distribution with the observed χ22/ν2. The degrees of freedom of the two distributions are ν1 [nu1] and ν2 [nu2] respectively in the above usage. Q is calculated as

where B(ν2/2, ν1/2) is a beta function and IBeta is a regularised incomplete beta function

Usage:                     q = Stat.fCompCDF(var1, nu1, var2, nu2);
As immediately above but the F-ratio, F = var1/var2 is provided as the reduced chi-squares or variances var1 [var1] and var2 [var2]. The method calculates the F-ratio.

[The method fCompCDF was previously called fTestProb and that named method has been retained.]

Inverse Cumulative Distribution Function
public static double fDistributionInverseCDF(int nu1, int nu2,double pofz)
Usage:                      F = Stat.fDistributionInverseCDF(nu1, nu1, prob);
Returns the value of F [F] for a given P [prob], ν1 [nu1] and ν2 [nu2] where these variables are related by the F-distribution cumulative distribution function


F-test value for a given Q probability
public static double fTestValueGivenFprob(double fProb, int nu1, int nu2)
Usage:                     fValue = Stat.fTestValueGivenFprob(fProb, nu1, nu2);
Returns the F-test value corresponding to the F-distribution probability, Q, [fProb in the above usage], for degrees of freedom nu1 and nu2.

Probability Density Function (pdf)
public static double fPDF(double fValue, int nu1, int nu2)
public static double fPDF(double var1, int nu1, double var2, int nu2)
Usage:                     p = Stat.fPDF(fValue, nu1, nu2);
Returns the probability, p, where

x is the ratio of observed reduced chi squares or variances, F = var1/var2 (fValue in the above usage), ν1 [nu1] and ν2 [nu2] are the number of degrees of freedom of the variances var1 and var2 respectively and B(ν1/2, ν2/2) is a beta function.

Usage:                     p = Stat.fPDF(var1, nu1, var2, nu2);
As immediately above but the F-ratio, F = var1/var2 is provided as the reduced chi-squares or variances var1 [var1] and var2 [var2]. The method calculates the F-ratio.

Generate F-distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] fRand(int nu1, int nu2,int n)
public static double[ ] fRand(int nu1, int nu2, int n, long seed)
Usage:                      deviates = Stat.fRand(nu1, nu2, n);
Returns an array, of length n, of F-distribution random deviates from a F-distribution of degrees of freedom nu1 and nu2. The Java class, Random, is used as the source of individual uniform random deviates required in the calculation taking the initial seed from the clock.
Usage:                      deviates = Stat.fRand(nu1, nu2, n, seed);
Returns an array, of length n, of F-distribution random deviates from an F-distribution of degrees of freedom nu1 and nu2. The Java class, Random, is used as the source of individual uniform random deviates required in the calculation with a user supplied initial seed, seed.

F-Distribution Order Stastic Medians
public static double[] fDistributionOrderStatisticMedians(int nu1, int nu2, int n)
Usage:                      medians = Stat.fDistributionOrderStatisticMedians(nu1, nu2, n);
Returns, for a F-Distribution distribution of degrees of freedom, nu1 and nu2, the n F-Distribution order statistic medians where
medians[i] = F−1(U[i])
F−1 is the inverse F-Distribution cumulative distribution function (see above) and U[i] is the ith uniform order statistic median.

F-Distribution Probabilty Plot
Probabilty Plots are now handled by a separate dedicated class, ProbabilityPlot





Fitting data to one or several of the above distributions

Instance method
public void fitOneOrSeveralDistributions()
Usage:                      st.fitOneOrSeveralDistributions();

Static method
public static void fitOneOrSeveralDistributions(double [] array)
Usage:                      Stat.fitOneOrSeveralDistributions(array);

A method that allows either the internal array of st [instance method] or the data passed in the one dimensional array of doubles, array, [static method] to be fitted to as many of the following distributions as the user chooses:
The choice/s are made via a dialog box.
The method calculates a suggested bin width which may be altered via a dialog box.
Two plots for each chosen distribution are displayed:
  1. The binned data frequencies with the best fit curve of the chosen distribution;
  2. The binned frequences against the expected frequencies for the chosen distribution.
The output text file (tab separated variables) lists:
and for each distribution chosen:
See Regression for a more comprehensive list of disrtibution fitting methods.


ERROR FUNCTIONS
Error Function
public static double erf(double x)
Usage:                      f = Stat.erf(x);
Returns the value of an Error Function of argument x:

The error function is calculated as the regularised incomplete gamma function, IGamma(0.5, x2).

Complementary Error Function
public static double erfc(double x)
Usage:                      f = Stat.erfc(x);
Returns the value of a Complementary Error Function of argument x:

i.e. erfc(x) = 1 - erf(x). The complementary error function is calculated as the complementary regularised incomplete gamma function, ICompGamma(0.5, x2).



BETA DISTRIBUTION AND BETA FUNCTIONS
Cumulative Distribution Function (cdf)
public static double betaCDF(double min, double max, double alpha, double beta, double limit)
public static double betaCDF(double alpha, double beta, double limit)
Usage:                      p = Stat.betaCDF(min, max, alpha, beta, limit);
If the measurements of a variable, x, are distributed according to a Beta distribution, defined on the interval [min, max], with a shape parameters α and β [arguments double alpha and double beta], this method returns the probability, P(z; α, β, min, max), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

where Β(α, β) is the beta function and IBeta((z-min)/(max-min); α, β) is the regularised incomplete beta function.

Usage:                      p = Stat.betaCDF(alpha, beta, limit);
If the measurements of a variable, x, are distributed according to a Beta distribution, defined on the interval [0, 1], with a shape parameters α and β [arguments double alpha and double beta], this method returns the probability, P(z; α, β), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

where Β(α, β) is the beta function and IBeta(z; α, β) is the regularised incomplete beta function.

Probability Density Function (pdf)
public static double betaPDF(double min, double max, double alpha, double beta, double x)
public static double betaPDF(double alpha, double beta, double x)
Usage:                      p = Stat.betaPDF(min, max, alpha, beta, x);
Returns the Beta Distribution probabilty, defined on the interval [min, max], p(x; α, β, min, max), where

α [argument double alpha] and β [argument double beta] are the shape parameters and Β(α, β) is the beta function.

Usage:                      p = Stat.betaPDF(alpha, beta, x);
Returns the Beta Distribution probabilty, defined on the interval [0,1], p(x; α, β), where

α [argument double alpha] and β [argument double beta] are the shape parameters and Β(α, β) is the beta function.

Generation of Beta distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] betaRand(double min, double max, double alpha, double beta, int n)
public static double[ ] betaRand(double alpha, double beta, int n)
public static double[ ] betaRand(double min, double max, double alpha, double beta, int n, long seed)
public static double[ ] betaRand(double alpha, double beta, int n, long seed)
Usage:                      deviates = Stat.betaRand(min, max, alpha, beta, n);
Returns an array, of length n, of Beta distribution random deviates from a Beta distribution, defined on the interval [min, max], of shape parameters, α, [alpha] and β, [beta]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the beta random deviates.

Usage:                      deviates = Stat.betaRand(alpha, beta, n);
Returns an array, of length n, of Beta distribution random deviates from a Beta distribution, defined on the interval [0, 1], of shape parameters, α, [alpha] and β, [beta]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the beta random deviates.

Usage:                      deviates = Stat.betaRand(min, max, alpha, beta, n, seed);
Returns an array, of length n, of Beta distribution random deviates from a Beta distribution, defined on the interval [min, max], of shape parameters, α, [alpha] and β, [beta]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the beta random deviates.

Usage:                      deviates = Stat.betaRand(alpha, beta, n, seed);
Returns an array, of length n, of Beta distribution random deviates from a Beta distribution, defined on the interval [0, 1], of shape parameters, α, [alpha] and β, [beta]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the beta random deviates.

Mean
public static double betaMean(double min, double max, double alpha, double beta)
public static double betaMean(double alpha, double beta)
Usage:                      mean = Stat.betaMean(min, max, alpha, beta, n);
Returns the mean of a Beta distribution defined on the interval [min, max];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.

Usage:                      mean = Stat.betaMean(alpha, beta, n);
Returns the mean of a Beta distribution defined on the interval [0, 1];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.

Mode
public static double betaMode(double min, double max, double alpha, double beta)
public static double betaMode(double alpha, double beta)
Usage:                      mean = Stat.betaMode(min, max, alpha, beta, n);
Returns the mode of a Beta distribution defined on the interval [min, max];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.

Usage:                      mean = Stat.betaMode(alpha, beta, n);
Returns the mode of a Beta distribution defined on the interval [0, 1];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.

Standard Deviation
public static double betaStandardDeviation(double min, double max, double alpha, double beta)
public static double betaStandardDeviation(double alpha, double beta)
Usage:                      mean = Stat.betaStandardDeviation(min, max, alpha, beta, n);
Returns the standard deviation of a Beta distribution defined on the interval [min, max];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.

Usage:                      mean = Stat.betaStandardDeviation(alpha, beta, n);
Returns the standard deviation of a Beta distribution defined on the interval [0, 1];

where
α [argument double alpha] and β [argument double beta] are the shape parameters.


Fit data to a Beta Distribution

Beta Function
public static double betaFunction(double z , double w)
Usage:                      b = Stat.beta(z, w);
Returns the value of a Beta Function of arguments z and w:

i.e. Gamma(z).Gamma(w)/Gamma(z+w). The Gamma Function values are calculated using the Lanczos approximation.

Regularised Incomplete Beta Function
public static double regularisedBetaFunction(double z, double w, double x)
public static double regularizedBetaFunction(double z, double w, double x)
Usage:                      ib = Stat.regularisedBetaFunction(z, w, x);
Returns the value of an Regularised Incomplete Beta Function of arguments z, w and x:

The function is calculated using the continued fraction approximation.
The method regularizedBetaFunction performs the same operation as regularisedBetaFunction. Previous and differently named versions of this method have been retained but are not listed here.

Continued Fraction calculation used in the Regularised Incomplete Beta Function
public static void resetCFmaxIter(int maxit)
Usage:                      Stat.resetCFmaxIter(maxit);
Resets the value of the maximum number of iterations, maxit, allowed in the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularized incomplete beta function (see immediately above). The default value is 500.

public static int getCFmaxIter()
Usage:                      maxit = Stat.getCFmaxIter();
Returns the value of the maximum number of iterations, maxit, allowed in the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularized incomplete beta function (see immediately above). The default value is 500.

public static void resetCFtolerance(double tolerance)
Usage:                      Stat.resetCFtolerance(tolerance);
Resets the value of the tolerance, tolerance, used to terminate the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularized incomplete beta function (see above).The default value is 1.0x10-8.

public static double getCFtolerance()
Usage:                      tolerance = Stat.getCFtolerance();
Returns the value of the tolerance, tolerance, used to terminate the evaluation of the continued fraction (method contFract) needed in the evaluation of the regularized incomplete beta function (see above).The default value is 1.0x10-8.




GAMMA DISTRIBUTION AND GAMMA FUNCTIONS
Cumulative Distribution Function (cdf)
public static double gammaCDF(double mu, double beta, double gamma, double limit)
public static double gammaCDF(double gamma, double x)
Usage:                      p = Stat.gammaCDF(mu, beta, gamma, limit);
If the measurements of a variable, x, are distributed according to a Gamma distribution with a location parameter μ [argument double mu], a scale parameter β [argument double beta] and a shape parameter γ [argument double gamma] this method returns the probability, P(z;β,γ, μ), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

where Γ(γ)is the gamma function and IGamma(γ, (z-μ)/β)is the regularised incomplete gamma function.

Usage:                      p = Stat.gammaCDF(gamma, limit);
If the measurements of a variable, x, are distributed according to a Standard Gamma distribution with a shape parameter γ [argument double gamma] this method returns the probability, P(z;γ), of observing a value of x in a random sample measurement which is less than a value, z [argument double limit], i.e.

where Γ(γ) is the gamma function and IGamma(γ, z) is the regularised incomplete gamma function.

Probability Density Function (pdf)
public static double gammaPDF(double mu, double beta, double gamma, double x)
public static double gammaPDF(double gamma, double x)
Usage:                      p = Stat.gammaPDF(mu, beta, gamma, x);
Returns the Gamma Distribution probabilty, p(x;β,γ, μ), where

μ [argument double mu] is the location parameter, β [argument double beta] is the scale parameter, γ [argument double gamma] is the a shape parameter and Γ(γ) is the gamma function.

Usage:                      p = Stat.gammaPDF(gamma, x);
Returns the Standard Gamma Distribution probabilty, p(x;γ), where

γ [argument double gamma] is the shape parameter and Γ(γ) is the gamma function.

Generation of Gamma distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] gammaRand(double mu, double beta, double gamma, int n)
public static double[ ] gammaRand(double mu, double beta, double gamma, int n, long seed)
Usage:                      deviates = Stat.gammaRand(mu, beta, gamma, n);
Returns an array, of length n, of Gamma distribution random deviates from a Gamma distribution of location parameter, μ, [mu], scale parameter, β, [beta] and shape parameter, γ [gamma]. The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the gamma random deviates.

Usage:                      deviates = Stat.gammaRand(mu, beta, gamma, n, seed);
Returns an array, of length n, of Gamma distribution random deviates from a Gamma distribution of location parameter, μ, [mu], scale parameter, β, [beta] and shape parameter, γ [gamma]. The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the gamma random deviates.

Mean
public static double gammaMean(double mu, double beta, double gamma)
Usage:                      mean = Stat.gammaMean(mu, beta, gamma);
Returns the mean of a Gamma distribution; mean = β*γ - μ where
μ [argument double mu] is the location parameter, β [argument double beta] is the location parameter and γ [argument double gamma] is the shape parameter.

Mode
public static double gammaMode(double mu, double beta, double gamma)
Usage:                      mode = Stat.gammaMode(mu, beta, gamma);
Returns the mode of a Gamma distribution; mode = β*(γ - 1) - μ for γ greater than or equal to one, where
μ [argument double mu] is the location parameter, β [argument double beta] is the location parameter and γ [argument double gamma] is the shape parameter.

Standard Deviation
public static double gammaStandardDeviation(double beta, double gamma)
Usage:                      sd = Stat.gammaStandardDeviation(beta, gamma);
Returns the standard deviation of a Gamma distribution;

where β [argument double beta] is the location parameter and γ [argument double gamma] is the shape parameter.

Fit data to a Gamma Distribution

Gamma Function
public static double gammaFunction(double x)
Usage:                      g = Stat.gammaFunction(x);
Returns the value of a Gamma Function of argument x:

The Gamma Function is calculated using the Lanczos approximation.

Inverse Gamma Function
public static double[] inverseGammaFunction(double gamma)
Usage:                      double[] x = Stat.inverseGammaFunction(gamma);
Returns the two values of x [x] for a given Γ(x) [gamma], for positive values of x, where these variables are related by the Gamma Function

x[0] contains the inverse Gamma Function value lying between zero and the minimum of the Gamma Function [x = 1.4616321399961483 and Γ(x) = 0.8856031944108839]; x[1] contains the inverse Gamma Function value lying above the minimum.

Lanczos Gamma function Approximation coefficients
The Lanczos approximation, for x>0, is


The Lanczos constant, gamma
public static double getLanczosGamma()
Usage:                      gammaConstant = Stat.getLanczosGamma();
Returns the value of the constant, gamma, in the Lanczos approximation (see above).

The Lanczos constant, N
public static int getLanczosN()
Usage:                      gammaConstant = Stat.getLanczosN();
Returns the value of the constant, N, in the Lanczos approximation (see above). The number of Lanczos coefficients = N+1.

The Lanczos coefficients
public static double[] getLanczosCoeff()
Usage:                      double[] coeff = Stat.getLanczosCoeff();
Returns the coefficients in the Lanczos approximation (c0, c1, c2, ...cN in above equation).

Log to base e of a Gamma Function
public static double logGammaFunction(double n)
Usage:                     lg = Stat.logGammaFunction(x);
Returns the log to base e of the value of a Gamma Function of argument x if this value is positive. The log(gamma function) value is calculated using an appropriately adapted Lanczos approximation.

Regularised Incomplete Gamma Function
public static double regularisedGammaFunction(double a, double x)
public static double regularizedGammaFunction(double a, double x)
Usage:                      ig = Stat.regularisedGammaFunction(a, x);
Returns the value of a Regularised Incomplete Gamma Function of arguments a and x:

A series approximation is used for x < a+1. A continued fraction approximation is used for x => a+1. The Gamma Function used in the calculation is calculated using the Lanczos approximation.
The method regularizedGammaFunction performs the same operation as regularisedGammaFunction. Previous and differently named versions of this method have been retained but are not listed here.

Complementary Regularised Incomplete Gamma Function
public static double complementaryRegularisedGammaFunction(double a, double x)
Usage:                      igc = Stat.complementaryRegularisedGammaFunction(a, x);
Returns the value of a Complementary Incomplete Gamma Function of arguments a and x:

i.e. IGammaComp(a,x) = 1 - IGamma(a,x). A series approximation is used for x < a+1. A continued fraction approximation is used for x => a+1. The Gamma Function used in the calculation is calculated using the Lanczos approximation.


The method complementaryRegularizedGammaFunction performs the same operation as complementaryRegularisedGammaFunction. Previous and differently named versions of this method have been retained but are not listed here.

Number of Iterations in Incomplete Gamma Function Calculation
public static void setIncGammaMaxIter(int nmax)
Usage:                     Stat.setIncGammaMaxIter(nmax);
Resets the value of the maximum iterations allowed in the series summation or continued fraction multiplication in the above calculations of the regularised incomplete gamma function. It resets the default value (1000), for that program.

public static int getIncGammaMaxIter()
Usage:                     nmax = Stat.getIncGammaMaxIter();
Returns the value of the maximum iterations allowed in the series summation or continued fraction multiplication in the above calculations of the regularised incomplete gamma function.

Tolerance in Regularised Incomplete Gamma Function Calculation
public static void setIncGammaMaxTol(int tol)
Usage:                     Stat.setIncGammaMaxTol(tol);
Resets the value of the tolerance against which further increments are tested in the series summation or continued fraction multiplication in the above calculations of the regularised incomplete gamma function. It resets the default value (1e-8), for that program.

public static double getIncGammaMaxTol()
Usage:                     tol = Stat.getIncGammaMaxTol();
Returns the value of the tolerance against which further increments are tested in the series summation or continued fraction multiplication in the above calculations of the regularised incomplete gamma function.

Minimum of the Gamma Function
public static double[] gammaFunctionMinimum()
Usage:                      double[] x = Stat.gammaFunctionMinimum();
Returns the values of Γ(x) and x, for positive values of x, at which Γ(x) is at its minimum value where these variables are related by the Gamma Function

x[0] contains the value of Γ(x) [0.8856031944108839] and x[1] contains the value of x [1.4616321399961483].





ERLANG DISTRIBUTION AND ERLANG CONNECTION, B AND C EQUATIONS
Erlang Distribution
Cumulative Distribution Function (cdf)
public static double erlangCDF(double lambda, int kay, double limit)
public static double erlangCDF(double lambda, long kay, double limit)
public static double erlangCDF(double lambda, double kay, double limit)
Usage:                      p = Stat.erlangCDF(lambda, kay, limit);
If the measurements of a variable, x, are distributed according to an Erlang distribution with a shape parameter λ [argument lambda] and an integer rate parameter k [argument kay (must, mathematically, be an integer though may be entered as a double)] this method returns the probability, P(z;λ,k), of observing a value of x in a random sample measurement which is less than a value, z [argument limit], i.e.

The Erlang distribution is equivalent to a Gamma Distribution in which the Gamma location parameter, μ is set to zero, the Gamma scale parameter, β, is the inverse of the Erlang rate paramete, λ, and the Gamma shape parameter, γ, is restricted to integer values, i.e. the Erlang shape parameter, k.

Probability Density Function (pdf)
public static double erlangPDF(double lambda, int kay, double x)
public static double erlangPDF(double lambda, long kay, double x)
public static double erlangPDF(double lambda, double kay, double x)
Usage:                      p = Stat.erlangPDF(lambda, kay, x);
Returns the Erlang Distribution probabilty, p(x;λ,k), where

λ [argument lambda] is the shape parameter and k [argument kay (must, mathematically, be an integer though may be entered as a double)] is the integer rate parameter. The Erlang distribution is equivalent to a Gamma Distribution in which the Gamma location parameter, μ is set to zero, the Gamma scale parameter, β, is the inverse of the Erlang rate paramete, λ, and the Gamma shape parameter, γ, is restricted to integer values, i.e. the Erlang shape parameter, k.

Generation of Erlang distribution random deviates
NB. A more extensive set of methods concerning the generation of this deviate may be found in the class PsRandom.
public static double[ ] erlangRand(double lambda, int kay, int n)
public static double[ ] erlangRand(double lambda, long kay, int n)
public static double[ ] erlangRand(double lambda, double kay, int n)
public static double[ ] erlangRand(double lambda, int kay, int n, long seed)
public static double[ ] erlangRand(double lambda, long kay, int n, long seed)
public static double[ ] erlangRand(double lambda, double kay, int n, long seed)
Usage:                      deviates = Stat.erlangRand(lambda, kay, n);
Returns an array, of length n, of Erlang distribution random deviates from an Erlang distribution of scale parameter, λ, [lambda] and rate parameter, k [kay (must, mathematically, be an integer though may be entered as a double)] . The Java class, Random, is used as the source of individual uniform random deviates, taking the initial seed from the clock, needed in calculating the Erlang random deviates.

Usage:                      deviates = Stat.erlangRand(lambda, kay, n, seed);
Returns an array, of length n, of Erlang distribution random deviates from an Erlang distribution of scale parameter, λ, [lambda] and rate parameter, k [kay (must, mathematically, be an integer though may be entered as a double)] . The Java class, Random, is used as the source of individual uniform random deviates, with a user supplied initial seed, seed, needed in calculating the gamma random deviates.

Mean
public static double erlangMean(double lambda, int kay)
public static double erlangMean(double lambda, long kay)
public static double erlangMean(double lambda, double kay)
Usage:                      mean = Stat.erlangMean(lambda, kay);
Returns the mean of an Erlang distribution;
mean = k/λ
where λ [argument lambda] is the shape parameter and k [argument kay (must, mathematically, be an integer though may be entered as a double)] is the rate parameter.

Mode
public static double erlangMode(double lambda, int kay)
public static double erlangMode(double lambda, long kay)
public static double erlangMode(double lambda, double kay)
Usage:                      mode = Stat.erlangMode(lambda, kay);
Returns the mode of an Erlang distribution;
mode = (k - 1)/λ2 for k greater than or equal to one
where λ [argument lambda] is the shape parameter and k [argument kay (must, mathematically, be an integer though may be entered as a double)] is the rate parameter.

Standard Deviation
public static double erlangStandardDeviation(double lambda, int kay)
public static double erlangStandardDeviation(double lambda, long kay)
public static double erlangStandardDeviation(double lambda, double kay)
Usage:                      sd = Stat.erlangStandardDeviation(lambda, kay);
Returns the standard deviation of an Erlang distribution;
standard deviation = k1/2/λ
where λ [argument lambda] is the shape parameter and k [argument kay (must, mathematically, be an integer though may be entered as a double)] is the rate parameter.

Fit data to an Erlang Distribution

Erlang Connections Busy, B and C Equations
See also the Engset Equation below.
Erlang Connections Busy Probability
public static double erlangMprobability(double totalTraffic, double totalResources, double em)
public static double erlangMprobability(double totalTraffic, long totalResourceslong em)
public static double erlangMprobability(double totalTraffic, int totalResourcesint em)
Usage:                      prob = Stat.erlangMprobability(totalTraffic, totalResources, em);
Returns the Erlang probability that m resources (connections) [em] in a telecommunications network will be busy, Pm, where

and A is the total traffic [totalTraffic], measured in erlangs and n is the total number of resources [totalResources], e.g. servers, in the system. The equation is unreliable if the number of customers is not much greater than the total number of resources (~10x) and if the customer requests are not independent, e.g. if they have been triggered by a common event such as responding to a talk show.

Erlang B Equation - Blocking Probability - integer resources
public static double erlangBprobability(double totalTraffic, double totalResources)
public static double erlangBprobability(double totalTraffic, long totalResources)
public static double erlangBprobability(double totalTraffic, int totalResources)
Usage:                      prob = Stat.erlangBprobability(totalTraffic, totalResources);
Returns the Erlang B probability that a resource request from a telecommunications customer will be denied due to lack of resources [Grade of Service (GoS)], PB.
If the total number of resources [totalResources] is, numerically, an integer PB is calculated as

where A is the total traffic [totalTraffic], measured in erlangs and n is the total number of resources [totalResources], e.g. servers, in the system.
If the total number of resources [totalResources] is not an integer PB is calculated as

where A is the total traffic [totalTraffic], measured in erlangs and x is the total number of resources [totalResources], e.g. servers, in the system.
The equations are unreliable if the number of customers is not much greater than the total number of resources (~10x) and if the customer requests are not independent, e.g. if they have been triggered by a common event such as responding to a talk show.
Stat.erlangBprobabilityNonIntRes(totalTraffic, totalResources) performs the same function as Stat.erlangBprobability(totalTraffic, totalResources) with totalResources of type double. It has been retained for compatibility purposes.

Erlang B Equation - Maximum Load
public static double erlangBload(double blockingProbability, double totalResources)
public static double erlangBload(double blockingProbability, long totalResources)
public static double erlangBload(double blockingProbability, int totalResources)
Usage:                      load = Stat.erlangBload(blockingProbability, totalResources);
Returns the maximum total traffic allowed for a blocking probability, PB, [blockingProbability] and n number of resources [totalResources] as defined by the Erlang B Equation, described immediately above.

Erlang B Equation - Resources
public static double[] erlangBresources(double blockingProbability, double totalTraffic)
Usage:                      array = Stat.erlangBresources(blockingProbability, totalTraffic);
Returns the numbers of resources bracketing the supplied blocking probability, blockingProbability for the supplied total traffic, totalTraffic where these parameters are defined by the Erlang B Equation, described above. The returned double array contains:


Erlang C Equation
Erlang C Equation - Non-zero Delay Probability
public static double erlangCprobability(double totalTraffic, double totalResources)
public static double erlangCprobability(double totalTraffic, long totalResources)
public static double erlangCprobability(double totalTraffic, int totalResources)
Usage:                      prob = Stat.erlangCprobability(totalTraffic, totalResources);
Returns the Erlang C probability that a telecommunications customer will experience a non-zero delay in obtaining a resource, PC, where

and A is the total traffic [totalTraffic], measured in erlangs and n is the total number of resources [totalResources], e.g. servers, in the system. The requests should be Poisson arrivals, the service times exponentially distributed and customers not having abandoned resource vrequests while waiting for a resource. The equation is unreliable if the number of customers is not much greater than the total number of resources (~10x) and if the customer requests are not independent, e.g. if they have been triggered by a common event such as responding to a talk show.

Erlang C Equation - Maximum Load
public static double erlangCload(double nonZeroDelayProbability, double totalResources)
public static double erlangCload(double nonZeroDelayProbability, long totalResources)
public static double erlangCload(double nonZeroDelayProbability, int totalResources)
Usage:                      load = Stat.erlangCload(nonZeroDelay, totalResources);
Returns the maximum total traffic allowed for a non-zero delay probability, PC, [nonZeroDelayProbability] and n number of resources [totalResources] as defined by the Erlang C Equation, described immediately above.

Erlang C Equation - Resources
public static double[] erlangCresources(double nonZeroDelayProbability, double totalTraffic)
Usage:                      array = Stat.erlangBresources(nonZeroDelayProbability, totalTraffic);
Returns the numbers of resources bracketing the supplied non-zero delay probability, nonZeroDelayProbability for the supplied total traffic, totalTraffic where these parameters are defined by the Erlang C Equation, described above. The returned double array contains:


ENGSET EQUATION
See also the Erlang B and C Equations above.
Engset Equation - Blocking Probability
public static double engsetProbability(double offeredTraffic, double totalResources, double numberOfSources)
public static double engsetProbability(double offeredTraffic, long totalResources, long numberOfSources)
public static double engsetProbability(double offeredTraffic, int totalResources, int numberOfSources)
Usage:                      prob = Stat.engsetProbability(offeredTraffic, totalResources, numberOfSources);
Returns the Engset probability that a resource request from a telecommunications customer will be denied due to lack of resources PB, where

and A is the offered traffic density [offeredTraffic], measured in erlangs, n is the total number of resources [totalResources], e.g. servers, in the system and S is the number of of sources of traffic [numberOfSources].

Engset Equation - Maximum Load
public static double engsetLoad(double blockingProbability, double totalResources, double numberOfSources)
public static double engsetLoad(double blockingProbability, long totalResources, long numberOfSources)
public static double engsetLoad(double blockingProbability, int totalResources, int numberOfSources)
Usage:                      load = Stat.engsetLoad(blockingProbability, totalResources, numberOfSources);
Returns the maximum total traffic allowed for a blocking probability, PB, [blockingProbability], n number of resources [totalResources] and S number of sources of traffic [numberOfSources] as defined by the Engset Equation, described immediately above.

Engset Equation - Resources
public static double[] engsetResources(double blockingProbability, double offeredTraffic, double numberOfSources)
public static double[] engsetResources(double blockingProbability, double offeredTraffic, long numberOfSources)
public static double[] engsetResources(double blockingProbability, double offeredTraffic, int numberOfSources)
Usage:                      array = Stat.engsetResources(blockingProbability, offeredTraffic, numberOfSources);
Returns the number of resources bracketing the supplied blocking probability, blockingProbability, for the supplied total traffic, offeredTraffic and number of sources, numberOfSources, where these parameters are defined by the Engset Equation, described above. The returned double array contains:

Engset Equation - Number of sources
public static double[] engsetSources(double blockingProbability, double offeredTraffic, double reources)
public static double[] engsetSources(double blockingProbability, double offeredTraffic, long resources)
public static double[] engsetSources(double blockingProbability, double offeredTraffic, int resources)
Usage:                      array = Stat.engsetSources(blockingProbability, offeredTraffic, resources);
Returns the number of sources bracketing the supplied blocking probability, blockingProbability, for the supplied total traffic, offeredTraffic and number of resources, resources, where these parameters are defined by the Engset Equation, described above. The returned double array contains:



FACTORIALS AND LOG(FACTORIALS)
Factorials
public static int factorial(int n)
public static long factorial(long n)
public static BigInteger factorial(BigInteger n)
public static double factorial(double n)
public static BigDecimal factorial(BigDecimal n)
Usage:                      f = Stat.factorial(n);
Returns the factorial of n.
If n = type int the range of n is limited by integer maximum size to 0 to 12.
If n = type long the range of n is limited by long integer maximum size to 0 to 20.
If n = type double avoids integer overflow but n must still be, numerically, an integer and rounding errors will make the returned value an approximation for n>21.

Log to base e of a factorial
public static double logFactorial(int n)
public static double logFactorial(long n)
public static double logFactorial(double n)
Usage:                     lf = Stat.logFactorial(n);
The argument, n, may be of type int, long or double, though if of type double, must still be, numerically, an integer. The log(factorial) is returned as type double and rounding errors may make the returned value an approximation.



Shannon Information Entropy and Shannon Binary Entropy
Instance methods
Shannon entropy
public double shannonEntropy()
public double shannonEntropyBit()
public double shannonEntropyNat()
public double shannonEntropyDit()
Returns the Shannon Information Entropy, Hn(p),

The array of probabilies, pi, should be entered via the Contructor as any of the types allowed by the constructor and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The entropy may be returned as binary digits (bits), natural logarithmic units of entropy or information (nats or nits) or decimal digits (dits). See usage immediately below.
Usage:                      entropy = st.shannonEntopy();
Usage:                      entropy = st.shannonEntopyBit();
Returns the Shannon Entropy, Hn(p),

as binary digits (bits). See xlog2x for the calculation of arrays of p.log2(p) without any constraints on p or their sum.

Usage:                      entropy = st.shannonEntopyNat();
Returns the Shannon Entropy, Hn(p),

as natural logarithmic units of entropy or information (nats or nits). See xlogex for the calculation of arrays of p.loge(p) without any constraints on p or their sum.

Usage:                      entropy = st.shannonEntopyNat();
Returns the Shannon Entropy, Hn(p),

as decimal digits (dits). See xlog10x for the calculation of arrays of p.log10(p) without any constraints on p or their sum.

Static methods
Shannon entropy
public static double shannonEntropy(double[] p)
public static double shannonEntropyBit(double[] p)
public static double shannonEntropyNat(double[] p)
public static double shannonEntropyDit(double[] p)
Returns the Shannon Information Entropy, Hn(p),

The array of probabilies, pi, should be entered as the array of doubles, argument p, and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The entropy may be returned as binary digits (bits), natural logarithmic units of entropy or information (nats or nits) or decimal digits (dits). See usage immediately below.
Usage:                      entropy = Stat.shannonEntopy(p);
Usage:                      entropy = Stat.shannonEntopyBit(p);
Returns the Shannon Entropy, Hn(p),

as binary digits (bits). See xlog2x for the calculation of arrays of p.log2(p) without any constraints on p or their sum.

Usage:                      entropy = Stat.shannonEntopyNat(p);
Returns the Shannon Entropy, Hn(p),

as natural logarithmic units of entropy or information (nats or nits). See xLogEx for the calculation of arrays of p.loge(p) without any constraints on p or their sum.

Usage:                      entropy = Stat.shannonEntopyNat(p);
Returns the Shannon Entropy, Hn(p),

as decimal digits (dits). See xLog10x for the calculation of arrays of p.log10(p) without any constraints on p or their sum.

Binary Shannon entropy
public static double binaryShannonEntropy(double p)
public static double binaryShannonEntropyBit(double p)
public static double binaryShannonEntropyNat(double p)
public static double binaryShannonEntropyDit(double p)
Returns the Shannon Information Entropy, H2(p, 1-p),

The probabily, p, should be entered as the double, argument p. The entropy may be returned as binary digits (bits), natural logarithmic units of entropy or information (nats or nits) or decimal digits (dits). See usage immediately below.
Usage:                      entropy = Stat.binaryShannonEntopy(p);
Usage:                      entropy = Stat.binaryShannonEntopyBit(p);
Returns the Shannon Entropy, H2(p, 1-p),

as binary digits (bits).

Usage:                      entropy = Stat.binaryShannonEntopyNat(p);
Returns the Shannon Entropy, H2(p, 1-p),

as natural logarithmic units of entropy or information (nats or nits).

Usage:                      entropy = Stat.binaryShannonEntopyNat(p);
Returns the Shannon Entropy, H2(p, 1-p),

as decimal digits (dits).



Rényi Information Entropy
Instance methods
Rényi entropy
public double renyiEntropy(double alpha)
public double renyiEntropyBit(double alpha)
public double renyiEntropyNat(double alpha)
public double renyiEntropyDit(double alpha)
Returns the Rényi Information Entropy, Hα(p),

The array of probabilies, pi, should be entered via the Contructor as any of the types allowed by the constructor and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The power, α, is entered via the argument alpha and may take any value from 0 to Double.POSTIVE_INFINITY. Large values of α (alpha) may cause underflow problems. If these occur an interpolated value is returned using a curve obtained by fitting 40 to 1000 points, below and including the last calculable point, and the minimum entropy value (α = ∞) to an exponential curve. The entropy may be returned as binary digits (bits), natural logarithmic units of entropy or information (nats or nits) or decimal digits (dits). See usage immediately below.
Usage:                      entropy = st.renyiEntopy(alpha);
Usage:                      entropy = st.renyiEntopyBit(alpha);
Returns the Rényi Entropy, Hα(p),

as binary digits (bits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Usage:                      entropy = st.renyiEntopyNat(alpha);
Returns the Rényi Entropy, Hα(p),

as natural logarithmic units of entropy or information (nats or nits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Usage:                      entropy = st.renyiEntopyNat(alpha);
Returns the Rényi Entropy, Hα(p),

as decimal digits (dits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Static methods
Rényi entropy
public static double renyiEntropy(double[] p, double alpha)
public static double renyiEntropyBit(double[] p, double alpha)
public static double renyiEntropyNat(double[] p, double alpha)
public static double renyiEntropyDit(double[] p, double alpha)
Returns the Rényi Information Entropy, Hα(p),

The array of probabilies, pi, should be entered as the array of doubles, argument p, and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The power, α, is entered via the argument alpha and may take any value from 0 to Double.POSTIVE_INFINITY. Large values of α (alpha) may cause underflow problems. If these occur an interpolated value is returned using a curve obtained by fitting 40 to 1000 points, below and including the last calculable point, and the minimum entropy value (α = ∞) to an exponential curve. The entropy may be returned as binary digits (bits), natural logarithmic units of entropy or information (nats or nits) or decimal digits (dits). See usage immediately below.
Usage:                      entropy = Stat.renyiEntropy(p, alpha);
Usage:                      entropy = Stat.renyiEntopyBit(p, alpha);
Returns the Rényi Entropy, Hα(p),

as binary digits (bits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Usage:                      entropy = Stat.renyiEntropyNat(p, alpha);
Returns the Rényi Entropy, Hα(p),

as natural logarithmic units of entropy or information (nats or nits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Usage:                      entropy = Stat.renyiEntropyNat(p, alpha);
Returns the Rényi Entropy, Hα(p),

as decimal digits (dits). See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Tsallis Entropy
Instance methods
public double tsallisEntropyNat(double q)
Usage:                      entropy = st.tsallisEntropyNat(q);
Returns the Tsallis Entropy, Sq(p),

The array of probabilies, pi, should be entered via the Contructor as any of the types allowed by the constructor and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The parameter, q, is entered via the argument q and may take any real value. See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Static methods
public static double tsallisEntropyNat(double[] p, double q)
Usage:                      entropy = Stat.tsallisEntropyNat(p, q);
Returns the Tsallis Entropy, Sq(p),

The array of probabilies, pi, should be entered as the array of doubles, argument p, and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The parameter, q, is entered via the argument q and may take any real value. See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

A Generalized Entropy
Instance methods
public double generalisedEntropyOneNat(double q, double r)
Usage:                      entropy = st.generalizedEntropyOneNat(q, r);
Returns the Generalised Entropy, Sq,r(p),

The array of probabilies, pi, should be entered via the Contructor as any of the types allowed by the constructor and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The parameters, q and r, are entered via the arguments q and r and may take any real value. See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

Static methods
public static double generalisedEntropyOneNat(double[] p, double q, double r)
Usage:                      entropy = Stat.generalisedEntropyOneNat(p, q, r);
Returns a Generalized Entropy, Sq,r(p),

The array of probabilies, pi, should be entered as the array of doubles, argument p, and may be in any order. This method allows a tolerance of 0.1% in the constraint of the sum of the probabilites, pi, to unity. The parameters, q and r, are entered via the arguments q and r and may take any real value. See ArrayMaths for manipulations of arrays of p without any constraints on p or their sum.

HISTOGRAMS
Arranging a set of data as a histogram
public static double[ ][ ] histogramBins(double[ ] data, double binWidth, double lowerLimit, double upperLimit)
public static double[ ][ ] histogramBins(double[ ] data, double binWidth, double lowerLimit)
public static double[ ][ ] histogramBins(double[ ] data, double binWidth)
Usage:                      results = Stat.histogramBins(data, binWidth, lowerLimit, upperLimit);
Takes an array of data (in the one dimensional array of double, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin starts at the value lowerLimit. All data points above the argument upperLimit are ignored. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.

Usage:                      results = Stat.histogramBins(data, binWidth, lowerLimit);
Takes an array of data (in the one dimensional array of doubles, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin starts at the value lowerLimit. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.

Usage:                      results = Stat.histogramBins(data, binWidth);
Takes an array of data (in the one dimensional array of double, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin start value is calculated by this method. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.

Plotting a set of data as a histogram
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, double upperLimit)
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, double upperLimit, String xLegend)
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit)
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth, double lowerLimit, String xLegend)
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth)
public static double[ ][ ] histogramBinsPlot(double[ ] data, double binWidth, String xLegend)
Usage:                      results = Stat.histogramBinsPlot(data, binWidth, lowerLimit, upperLimit);
Takes an array of data (in the one dimensional array of double, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin starts at the value lowerLimit. All data points above the argument upperLimit are ignored. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.
The results are additionally displayed as a histogram plot with no x-axis (abscissa axis) legend.

Usage:                      results = Stat.histogramBinsPlot(data, binWidth, lowerLimit, upperLimit, xLegend);
As immediately above but with the results are additionally displayed as a histogram plot with the x-axis (abscissa axis) legend supplied by the argument, xLegend.

Usage:                      results = Stat.histogramBinsPlot(data, binWidth, lowerLimit);
Takes an array of data (in the one dimensional array of double, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin starts at the value lowerLimit. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.
The results are additionally displayed as a histogram plot with no x-axis (abscissa axis) legend.

Usage:                      results = Stat.histogramBinsPlot(data, binWidth, lowerLimit, xLegend);
As immediately above but with the results are additionally displayed as a histogram plot with the x-axis (abscissa axis) legend supplied by the argument, xLegend.

Usage:                      results = Stat.histogramBinsPlot(data, binWidth);
Takes an array of data (in the one dimensional array of double, data in the above usage) and returns an histogram of the frequencies in bins of equal width, binWidth. The first bin start value is calculated by this method. The frequencies are returned in results[1][0], results[1][1], results[1][2], results[1][3], etc. The centre data values of each bin are returned in results[0][0], results[0][1], results[0][2], results[0][3], etc.
The results are additionally displayed as a histogram plot with no x-axis (abscissa axis) legend.

Usage:                      results = Stat.histogramBinsPlot(data, binWidth, xLegend);
As immediately above but with the results are additionally displayed as a histogram plot with the x-axis (abscissa axis) legend supplied by the argument, xLegend.

OUTLIER DETECTION

GRUBBS’ TEST
Grubbs’ test for a single outlier checks the largest standardised residual, G, against a critical Tn value where

n is the number of observations, α is the significance level of the Grubbs’ test [typically 0.05 (5%)] and tα/(nm), n-2 is the student’s t value for a critical probabilty of α/(nm) and n-2 degrees of freedom with m=1 for a one-sided distribution test and m=2 for a two-sided distribution test.
An outlier is identified if G>Tn
Grubbs’ test does not behave well in the presence of multiple outliers.
Methods for identifying an upper or lower outlier, a lower outlier or an upper outlier are described below.

Instant methods
public ArrayList<Object> outlierGrubbs(double significance)
Usage:                      ArrayList<Object> outl = st.outlierGrubbs(significance);
This method tests for the presence of a single outlier, lower or upper, in the data entered via a Stat constructor, at a significance level entered as the argument, significance. An outlier is identified if

where ȳ is the sample data mean and s is the sample data standard deviation.
The output ArrayList contains the elements:
element 0  (boolean)  true if an outlier identified, false if not
element 1  (double)  the value of the outlier if an outlier identified, NaN if not
element 2  (int)  the index of the outlier if an outlier identified, -1 if not
element 3  (double[])  the data array with the outlier removed, the original data array if no outlier identified
element 4  (double)  Grubbs’ G value
element 5  (double)  Grubbs’ Tn value
element 6  (double)  significance level used
element 7  (int)number of data points

public ArrayList<Object> lowerOutlierGrubbs(double significance)
Usage:                      ArrayList<Object> outl = st.lowerOutlierGrubbs(significance);
This method tests for the presence of a single lower outlier in the data entered via a Stat constructor, at a significance level entered as the argument, significance. An outlier is identified if

where ymin is the minimum data value, ȳ is the sample data mean and s is the sample data standard deviation.
The output array is as described above for the outlierGrubbs(significance) method.

public ArrayList<Object> upperOutlierGrubbs(double significance)
Usage:                      ArrayList<Object> outl = st.upperOutlierGrubbs(significance);
This method tests for the presence of a single upper outlier in the data entered via a Stat constructor, at a significance level entered as the argument, significance. An outlier is identified if

where ymax is the maximum data value, ȳ is the sample data mean and s is the sample data standard deviation.
The output array is as described above for the outlierGrubbs(significance) method.

Static methods
public static ArrayList<Object> outlierGrubbs(double[] data, double significance)
Usage:                      ArrayList<Object> outl = Stat.outlierGrubbs(data, significance);
This method tests for the presence of a single outlier, lower or upper, in the data entered via the argument data, at a significance level entered as the argument, significance. An outlier is identified if

The output array is as described above for the outlierGrubbs(significance) method.

public static ArrayList<Object> lowerOutlierGrubbs(double[] data, double significance)
Usage:                      ArrayList<Object> outl = Stat.lowerOutlierGrubbs(data, significance);
This method tests for the presence of a single lower outlier in the data entered via the argument data, at a significance level entered as the argument, significance. An outlier is identified if

The output array is as described above for the outlierGrubbs(significance) method.

public static ArrayList<Object> upperOutlierGrubbs(double[] data, double significance)
Usage:                      ArrayList<Object> outl = Stat.upperOutlierGrubbs(data, significance);
This method tests for the presence of a single upper outlier in the data entered via the argument data, at a significance level entered as the argument, significance. An outlier is identified if

The output array is as described above for the outlierGrubbs(significance) method.

public static double getGrubbsOneSidedCriticalT(double significance, int nObservations)
Usage:                      grubbsT = Stat.getGrubbsOneSidedCriticalT(significance, nObservations);
This method returns, for n [nObservations], a significance level of α [significance] and a one-sided distribution, the Tn value where

n is the number of observations, α is the significance level of the Grubbs’ test [typically 0.05 (5%)] and tα/(nm), n-2 is the student’s t value for a critical probabilty of α/(nm) and n-2 degrees of freedom with m=1.

public static double getGrubbsTwoSidedCriticalT(double significance, int nObservations)
Usage:                      grubbsT = Stat.getGrubbsTwoSidedCriticalT(significance, nObservations);
This method returns, for n [nObservations], a significance level of α [significance] and a two-sided distribution, the Tn value where

n is the number of observations, α is the significance level of the Grubbs’ test [typically 0.05 (5%)] and tα/(nm), n-2 is the student’s t value for a critical probabilty of α/(nm) and n-2 degrees of freedom with m=2.

ANSCOMBE’S TEST
Anscombe maximum normalised residual test for the lower outliers
Instance method
public ArrayList<Object> lowerOutliersAnscombe(double constant)
public ArrayList<Object> lowerOutliersAnscombe(BigDecimal constant)
public ArrayList<Object> lowerOutliersAnscombe(BigInteger constant)
Usage:                      ArrayList<Object> outl = st.lowerOutliersAnscombe_as_xxxx(constant);

Static method
public static Vector<Object> lowerOutliersAnscombe(double[ ] data, double constant)
public static Vector<Object> lowerOutliersAnscombeAsVector(double[ ] data, double constant)
public static ArrayList<Object> lowerOutliersAnscombeAsArrayList(double[ ] data, double constant)
public static Vector<Object> lowerOutliersAnscombe(double[ ] data, BigDecimal BigDecimal)
public static Vector<Object> lowerOutliersAnscombeAsVector(BigDecimal[ ] data, BigDecimal constant)
public static ArrayListt<Object> lowerOutliersAnscombeAsArrayList(BigDecimal[ ] data, BigDecimal constant)
public static Vector<Object> lowerOutliersAnscombe(double[ ] data, BigInteger BigInteger)
public static Vector<Object> lowerOutliersAnscombeAsVector(BigInteger[ ] data, BigInteger constant)
public static ArrayList<Object> lowerOutliersAnscombeAsArrayList(BigInteger[ ] data, BigInteger constant)
Usage:                      ArrayList<Object> outl = Stat.lowerOutliersAnscombeAsArrayList(data, constant);

Usage:                      Vector<Object> outl = Stat.lowerOutliersAnscombe(data, constant);
Usage:                      Vector<Object> outl = Stat.lowerOutliersAnscombeAsVector(data, constant);

Identifies lower outliers in the internal array of st [instance method] or in the array, data [x in the formulae below] [static method], using the Anscobe discordancy test

The constant, C, is the argument, constant in the above usage. If xl is found to be an outlier the test is repeated on the data with the outlier removed. This recursive procedure is repeated until no outliers are found.
The methods return an ArrayList<Object> or Vector<Object> whose elements are:
If no outliers are found the outlier and outlier indices arrays are returned as null

Anscombe maximum normalised residual test for the upper outliers
Instance method
public Vector<Object> upperOutliersAnscombe(double constant)
public Vector<Object> upperOutliersAnscombe(BigDecimal constant)
public Vector<Object> upperOutliersAnscombe(BigInteger constant)
Usage:                      ArrayList<Object> outl = st.upperOutliersAnscombe_as_xxxx(constant);

Static method
public static Vector<Object> upperOutliersAnscombe(double[ ] data, double constant)
public static Vector<Object> upperOutliersAnscombeAsVector(double[ ] data, double constant)
public static ArrayList<Object> upperOutliersAnscombeAsArrayList(double[ ] data, double constant)
public static Vector<Object> upperOutliersAnscombe(double[ ] data, BigDecimal BigDecimal)
public static Vector<Object> upperOutliersAnscombeAsVector(BigDecimal[ ] data, BigDecimal constant)
public static ArrayListt<Object> upperOutliersAnscombeAsArrayList(BigDecimal[ ] data, BigDecimal constant)
public static Vector<Object> upperOutliersAnscombe(double[ ] data, BigInteger BigInteger)
public static Vector<Object> upperOutliersAnscombeAsVector(BigInteger[ ] data, BigInteger constant)
public static ArrayList<Object> upperOutliersAnscombeAsArrayList(BigInteger[ ] data, BigInteger constant)
Usage:                      ArrayList<Object> outl = Stat.upperOutliersAnscombeAsArrayList(data, constant);

Usage:                      Vector<Object> outl = Stat.upperOutliersAnscombe(data, constant);
Usage:                      Vector<Object> outl = Stat.upperOutliersAnscombeAsVector(data, constant);

Identifies upper outliers in the internal array of st [instance method] or in the array, data [x in the formulae below] [static method], using the Anscobe discordancy test

The remaining terms are as described immediately above under lower outliers and the returned Vector<Object> or arrayList<Object> is as described immediately above under lower outliers.

References: Anscombe F J (1960) Rejection of outliers, Technometrics 2, 123-147.
See also Barnett V & Lewis T (1984) Outliers in statistical data, 2nd edn., Chichester & New York, John Wiley, for a general discussion on outlier detection and on the care to be taken in the recursive use of this test.



DEFINITION

ERLANG
The erlang is a dimensionless unit of traffic density in a telecommunication system named after the Danish mathematician/telecommunications pioneer, Agnar Krarup Erlang.

An erlang is defined as the the number of calls per unit time, e.g. per hour, multiplied by the duration of the call in corresponding time units, e.g. in hours.

Example: The users of a telephone network make 118 calls in one hour and the average duration of these calls is 12 minutes:
Minutes of traffic in the hour = number of calls x duration = 118 x 12 = 1416
Hours of traffic in the hour = 1416 / 60 = 23.6
Traffic density = 23.6 erlangs

The erlang unit is used in the Erlang B and C Equations methods.



METHODS INHERITED FROM THE SUPERCLASS, ArrayMaths

The list and details of the methods inherited from ArrayMaths can be found on Inherited Methods. Some of these methods override the corresponding ArrayMaths method.




OTHER CLASSES USED BY THIS CLASS

This class uses the following classes in this library:


PERMISSION TO USE

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.

Public listing of the source codes on the internet is not permitted.

Redistribution of the source codes or of the flanagan.jar file is not permitted.

Redistribution in binary form of all or parts of these classes is not permitted.

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.



This page was prepared by Dr Michael Thomas Flanagan