JMSLTM Numerical Library 4.0

com.imsl.stat
Class Summary

java.lang.Object
  extended bycom.imsl.stat.Summary
All Implemented Interfaces:
Cloneable, Serializable

public class Summary
extends Object
implements Serializable, Cloneable

Computes basic univariate statistics.

For the data in x. Summary computes the sample mean, variance, minimum, maximum, and ther basic statistics. It also computes confidence intervals for the mean and variance if the sample is assumed to be from a normal population.

Missing values, that is, values equal to NaN (not a number), are excluded from the computations. The sum of the weights is used only in computing the mean (of course, then the weighted mean is used in computing the central moments). The definitions of some of the statistics are given below in terms of a single variable x. The i-th datum is x_i, with corresponding weight w_i. If weights are not specified, the w_i are identically one. The summation in each case is over the set of valid observations, based on the presence of missing values in the data.

Number of nonmissing observations,

n = sum {f_i }

Mean,

bar x_w  = frac{{sum {f_i w_i x_i } }}{{sum 
  {f_i w_i } }}

Variance,

s_w^2  = frac{{sum {f_i w_i left( {x_i  - 
  bar x_w } right)^2 } }}{{n - 1}}

Skewness,

frac{{sum {f_i w_i left( {x_i  - bar x_w } 
  right)^3 /n} }}{{[sum {f_i w_i left( {x_i  - bar x_w } right)^2 
  /n]^{3/2} } }}

Excess or Kurtosis,

frac{{sum {f_i w_i left( {x_i  - bar x_w } 
  right)^4 /n} }}{{[sum {f_i w_i left( {x_i  - bar x_w } right)^2 /n]^2 } 
  }} - 3

Minimum,

x_{rm min}   = min (x_i )

Maximum,

x_{rm max}   = max (x_i )

See Also:
Example, Serialized Form

Constructor Summary
Summary()
          Constructs a new summary statistics object.
 
Method Summary
 double[] confidenceMean(double p)
          Returns the confidence interval for the mean (assuming normality).
 double[] confidenceVariance(double p)
          Returns the confidence interval for the variance (assuming normality).
 double getKurtosis()
          Returns the kurtosis.
 double getMaximum()
          Returns the maximum.
 double getMean()
          Returns the population mean.
 double getMinimum()
          Returns the minimum.
 double getSampleStandardDeviation()
          Returns the sample standard deviation.
 double getSampleVariance()
          Returns the sample variance.
 double getSkewness()
          Returns the skewness.
 double getStandardDeviation()
          Returns the population standard deviation.
 double getVariance()
          Returns the population variance.
static double kurtosis(double[] x)
          Returns the kurtosis of the given data set.
static double kurtosis(double[] x, double[] weight)
          Returns the kurtosis of the given data set and associated weights.
static double maximum(double[] x)
          Returns the maximum of the given data set.
static double mean(double[] x)
          Returns the mean of the given data set.
static double mean(double[] x, double[] weight)
          Returns the mean of the given data set with associated weights.
static double median(double[] x)
          Returns the median of the given data set.
static double minimum(double[] x)
          Returns the minimum of the given data set.
static double mode(double[] x)
          Returns the mode of the given data set.
static double sampleStandardDeviation(double[] x)
          Returns the sample standard deviation of the given data set.
static double sampleStandardDeviation(double[] x, double[] weight)
          Returns the sample standard deviation of the given data set and associated weights.
static double sampleVariance(double[] x)
          Returns the sample variance of the given data set.
static double sampleVariance(double[] x, double[] weight)
          Returns the sample variance of the given data set and associated weights.
static double skewness(double[] x)
          Returns the skewness of the given data set.
static double skewness(double[] x, double[] weight)
          Returns the skewness of the given data set and associated weights.
static double standardDeviation(double[] x)
          Returns the population standard deviation of the given data set.
static double standardDeviation(double[] x, double[] weight)
          Returns the population standard deviation of the given data set and associated weights.
 void update(double x)
          Adds an observation to the Summary object.
 void update(double[] x)
          Adds a set of observations to the Summary object.
 void update(double[] x, double[] weight)
          Adds a set of observations and associated weights to the Summary object.
 void update(double x, double weight)
          Adds an observation and associated weight to the Summary object.
static double variance(double[] x)
          Returns the population variance of the given data set.
static double variance(double[] x, double[] weight)
          Returns the population variance of the given data set and associated weights.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Summary

public Summary()
Constructs a new summary statistics object.

Method Detail

confidenceMean

public double[] confidenceMean(double p)
Returns the confidence interval for the mean (assuming normality).

Parameters:
p - a double, the confidence level desired, usually 0.90, 0.95 or 0.99.
Returns:
a double array of length 2 which contains the lower and upper confidence limits for the mean

confidenceVariance

public double[] confidenceVariance(double p)
Returns the confidence interval for the variance (assuming normality).

Parameters:
p - a double, the confidence level desired, usually 0.90, 0.95 or 0.99.
Returns:
a double array of length 2 which contains the lower and upper confidence limits for the variance

getKurtosis

public double getKurtosis()
Returns the kurtosis.

Returns:
a double representing the kurtosis

getMaximum

public double getMaximum()
Returns the maximum.

Returns:
a double representing the maximum

getMean

public double getMean()
Returns the population mean.

Returns:
a double representing the population mean

getMinimum

public double getMinimum()
Returns the minimum.

Returns:
a double representing the minimum

getSampleStandardDeviation

public double getSampleStandardDeviation()
Returns the sample standard deviation.

Returns:
a double representing the sample standard deviation

getSampleVariance

public double getSampleVariance()
Returns the sample variance.

Returns:
a double representing the sample variance

getSkewness

public double getSkewness()
Returns the skewness.

Returns:
a double representing the skewness

getStandardDeviation

public double getStandardDeviation()
Returns the population standard deviation.

Returns:
a double representing the population standard deviation

getVariance

public double getVariance()
Returns the population variance.

Returns:
a double representing the population variance

kurtosis

public static double kurtosis(double[] x)
Returns the kurtosis of the given data set.

Parameters:
x - a double array containing the data set whose kurtosis is to be found
Returns:
a double, the kurtosis of the given data set

kurtosis

public static double kurtosis(double[] x,
                              double[] weight)
Returns the kurtosis of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose kurtosis is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the kurtosis of the given data set

maximum

public static double maximum(double[] x)
Returns the maximum of the given data set.

Parameters:
x - a double array containing the data set whose maximum is to be found
Returns:
a double, the maximum of the given data set

mean

public static double mean(double[] x)
Returns the mean of the given data set.

Parameters:
x - a double array containing the data set whose mean is to be found
Returns:
a double, the mean of the given data set

mean

public static double mean(double[] x,
                          double[] weight)
Returns the mean of the given data set with associated weights.

Parameters:
x - a double array containing the data set whose mean is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the mean of the given data set

median

public static double median(double[] x)
Returns the median of the given data set.

Parameters:
x - a double array containing the data set whose median is to be found
Returns:
a double, the median of the given data set

minimum

public static double minimum(double[] x)
Returns the minimum of the given data set.

Parameters:
x - a double array containing the data set whose minimum is to be found
Returns:
a double, the minimum of the given data set

mode

public static double mode(double[] x)
Returns the mode of the given data set. Ties are broken at random.

Parameters:
x - a double array containing the data set whose mode is to be found
Returns:
a double, the mode of the given data set

sampleStandardDeviation

public static double sampleStandardDeviation(double[] x)
Returns the sample standard deviation of the given data set.

Parameters:
x - a double array containing the data set whose sample standard deviation is to be found
Returns:
a double, the sample standard deviation of the given data set

sampleStandardDeviation

public static double sampleStandardDeviation(double[] x,
                                             double[] weight)
Returns the sample standard deviation of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose sample standard deviation is to be found
weight - a double array containing the weights associated with the data points x.
Returns:
a double, the sample standard deviation of the given data set

sampleVariance

public static double sampleVariance(double[] x)
Returns the sample variance of the given data set.

Parameters:
x - a double array containing the data set whose sample variance is to be found
Returns:
a double, the sample variance of the given data set

sampleVariance

public static double sampleVariance(double[] x,
                                    double[] weight)
Returns the sample variance of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose sample variance is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the sample variance of the given data set

skewness

public static double skewness(double[] x)
Returns the skewness of the given data set.

Parameters:
x - a double array containing the data set whose skewness is to be found
Returns:
a double, the skewness of the given data set

skewness

public static double skewness(double[] x,
                              double[] weight)
Returns the skewness of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose skewness is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the skewness of the given data set

standardDeviation

public static double standardDeviation(double[] x)
Returns the population standard deviation of the given data set.

Parameters:
x - a double array containing the data set whose standard deviation is to be found
Returns:
a double, the population standard deviation of the given data set

standardDeviation

public static double standardDeviation(double[] x,
                                       double[] weight)
Returns the population standard deviation of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose standard deviation is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the population standard deviation of the given data set

update

public void update(double x)
Adds an observation to the Summary object.

Parameters:
x - a double, the data observation to be added

update

public void update(double[] x)
Adds a set of observations to the Summary object.

Parameters:
x - a double array of data observations to be added

update

public void update(double[] x,
                   double[] weight)
Adds a set of observations and associated weights to the Summary object.

Parameters:
x - a double array of data observations to be added
weight - a double array of weights associated with the observations

update

public void update(double x,
                   double weight)
Adds an observation and associated weight to the Summary object.

Parameters:
x - a double, the data observation to be added
weight - a double, the weight associated with the observation

variance

public static double variance(double[] x)
Returns the population variance of the given data set.

Parameters:
x - a double array containing the data set whose population variance is to be found
Returns:
a double, the population variance of the given data set

variance

public static double variance(double[] x,
                              double[] weight)
Returns the population variance of the given data set and associated weights.

Parameters:
x - a double array containing the data set whose population variance is to be found
weight - a double array containing the weights associated with the data points x
Returns:
a double, the population variance of the given data set

JMSLTM Numerical Library 4.0

Copyright 1970-2006 Visual Numerics, Inc.
Built June 1 2006.