Class VisualNumerics.math.Statistics
All Packages Class Hierarchy This Package Previous Next Index
Class VisualNumerics.math.Statistics
java.lang.Object
|
+----VisualNumerics.math.Statistics
- public class Statistics
- extends Object
The statistics library. This class complements the class Math by
providing more advanced functions. This class cannot be instantiated
because all of its methods are static.
-
average(double[])
- Returns the average (mean).
-
FCdf(double, double, double)
-
Returns the value of the cummulative F distribution function.
-
inverseFCdf(double, double, double)
-
Returns the inverse of the cummulative F distribution function.
-
inverseNormalCdf(double)
-
Returns the inverse of the cummulative normal (Gaussian) distribution function.
-
inverseTCdf(double, double)
-
-
kurtosis(double[])
-
Returns the kurtosis.
-
linearFit(double[], double[])
-
Returns the the best least squares fit of a line
through the data.
-
maximum(double[])
-
Returns the maximum value.
-
median(double[])
-
Returns the median value.
-
minimum(double[])
-
Returns the minimum value.
-
normalCdf(double)
-
Returns the value of the cummulative normal (Gaussian) distribution function.
-
range(double[])
-
Returns the range (xmax-xmin).
-
skew(double[])
-
Returns the skew.
-
slope(double[], double[])
-
Returns the the slope of the best least squares fit
of a line passing through the origin to the data.
-
standardDeviation(double[])
-
Returns the sample standard deviation.
-
tCdf(double, double)
-
-
variance(double[])
-
Returns the sample variance.
Statistics
public Statistics()
average
public static double average(double x[])
- Returns the average (mean).
- Parameters:
- x - The input double vector for which the average is desired.
- Returns:
- A scalar of type double containing the average (mean) of
input vector x.
-
Algorithm:
-
This method returns the sample mean which is equal to the sum of
the elements of input x divided by the length of x.
median
public static double median(double x[])
- Returns the median value.
- Parameters:
- x - The input double vector for which the median is desired.
- Returns:
- A scalar of type double containing the median of the
input vector x.
-
Algorithm:
-
This method returns the number in the middle of a set of numbers.
Half of the numbers in the set will have values less than or equal
to the returned value and half will have values greater than or equal
to the returned value. If there is an even number of elements in the
set of values to be evaluated, then the average of the middle two
numbers is returned.
minimum
public static double minimum(double x[])
- Returns the minimum value.
- Parameters:
- x - The input double vector for which the minimum is desired.
- Returns:
- A scalar of type double containing the minimum element of the
input vector x.
maximum
public static double maximum(double x[])
- Returns the maximum value.
- Parameters:
- x - The input double vector for which the maximum is desired.
- Returns:
- A scalar of type double containing the maximum element of the
input vector x.
variance
public static double variance(double x[])
- Returns the sample variance.
- Parameters:
- x - The input double vector containing the elements for which the sample variance is desired.
- Returns:
- A scalar of type double containing the sample variance of the
input vector x.
-
Algorithm:
-
This method returns the sample variance of a set of values. Let n be
the length of input vector x. Let xmean be the sample mean of x. The
sample variance = 1/(n-1)*SUM(xi - xmean)2
standardDeviation
public static double standardDeviation(double x[])
- Returns the sample standard deviation.
- Parameters:
- x - The input double vector for which the sample standard deviation is desired.
- Returns:
- A scalar of type double containing the sample standard deviation of the
input vector x.
-
Algorithm:
-
This method returns the sample standard deviation of a set of values. The
sample standard deviation is the square root of the sample variance
of the set of values.
skew
public static double skew(double x[])
- Returns the skew.
- Parameters:
- x - The input double vector for which the skewness is desired.
- Returns:
- A scalar of type double containing the skewness of the
input vector x.
kurtosis
public static double kurtosis(double x[])
- Returns the kurtosis.
- Parameters:
- x - The input double vector for which the kurtosis is desired.
- Returns:
- A scalar of type double containing the kurtosis of the
input vector x.
range
public static double range(double x[])
- Returns the range (xmax-xmin).
- Parameters:
- x - The input double vector for which the range is desired.
- Returns:
- A scalar of type double containing (xmax-xmin) where xmax is
the maximum element of input vector x and xmin is the minimum element of
input vector x.
linearFit
public static double[] linearFit(double x[],
double y[])
- Returns the the best least squares fit of a line
through the data.
- Parameters:
- x - An input double vector containing the x-values of the data.
- y - An input double vector containing the y-values of the data.
- Returns:
- The return value is an array of two
doubles, call it coef[]. The equation of the line
is y = coef[0]+coef[1]*x.
If all of the x's are equal then the model is degenerate
and it returns coef[0] equal to the mean of the y's and
coef[1] equal to zero.
slope
public static double slope(double x[],
double y[])
- Returns the the slope of the best least squares fit
of a line passing through the origin to the data.
- Parameters:
- x - An input double vector containing the x-values of the data.
- y - An input double vector containing the y-values of the data.
- Returns:
- The return value is a scalar of type double containing the
slope the best least squares fit of a line passing through the origin to the data.
FCdf
public static double FCdf(double x,
double degreesFreedomNumerator,
double degreesFreedomDenominator)
- Returns the value of the cummulative F distribution function.
- Parameters:
- x - An input double scalar containing the argument for which the
F distribution function is to be evaluated.
- degreesFreedomNumerator - An input double scalar containing the
numerator degrees of freedom. degreesFreedomNumerator must be positive.
- degreesFreedomDenominator - An input double scalar containing the
denominator degrees of freedom. degreesFreedomDenominator must be positive.
- Returns:
- The return value is a scalar of type double containing the
probability that an F random variable takes a value less than or equal
to the input x.
Double.NaN is returned when the
degreesFreedomNumerator or degreesFreedomDenominator is <= 0.
inverseFCdf
public static double inverseFCdf(double p,
double degreesFreedomNumerator,
double degreesFreedomDenominator)
- Returns the inverse of the cummulative F distribution function.
- Parameters:
- p - An input double scalar containing the probability for which the
inverse F distribution function is to be evaluated. Input p must be
in the open interval (0,1).
- degreesFreedomNumerator - An input double scalar containing the
numerator degrees of freedom. degreesFreedomNumerator must be positive.
- degreesFreedomDenominator - An input double scalar containing the
denominator degrees of freedom. degreesFreedomDenominator must be positive.
- Returns:
- The return value is a scalar of type double containing the
inverse cummulative F distribution function value. The
probability that an F random variable takes a value less than or equal
to this value is the input probability p.
Double.NaN will be returned if the probability p is not in the open interval (0,1) or
degreesFreedomNumerator or degreesFreedomDenominator is <= 0.
tCdf
public static double tCdf(double t,
double degreesFreedom)
inverseTCdf
public static double inverseTCdf(double p,
double degreesFreedom)
normalCdf
public static double normalCdf(double x)
- Returns the value of the cummulative normal (Gaussian) distribution function.
- Parameters:
- x - An input double scalar containing the argument for which the
normal (Gaussian) distribution function is to be evaluated.
- Returns:
- The return value is a scalar of type double containing the
probability that a normal random variable takes a value less than or equal
to the input x.
inverseNormalCdf
public static double inverseNormalCdf(double p)
- Returns the inverse of the cummulative normal (Gaussian) distribution function.
- Parameters:
- p - An input double scalar containing the probability for which the
inverse normal distribution function is to be evaluated. Input p must be
in the open interval (0,1).
- Returns:
- The return value is a scalar of type double containing the
inverse cummulative normal distribution function value. The
probability that a standard normal random variable takes a value less than or equal
to this value is the input probability p.
Double.NaN will be returned if the probability p is not in the open interval (0,1).
All Packages Class Hierarchy This Package Previous Next Index