Class Summary
- All Implemented Interfaces:
Serializable,Cloneable
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]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).doubleReturns the kurtosis.doubleReturns the maximum.doublegetMean()Returns the population mean.doubleReturns the minimum.intReturns the number of non-missing observations.doubleReturns the sample standard deviation.doubleReturns the sample variance.doubleReturns the skewness.doubleReturns the population standard deviation.doubleReturns the population variance.static doublekurtosis(double[] x) Returns the kurtosis of the given data set.static doublekurtosis(double[] x, double[] weight) Returns the kurtosis of the given data set and associated weights.static doublemaximum(double[] x) Returns the maximum of the given data set.protected static intmaximum(int[] x) Returns the maximum of the given data set.static doublemean(double[] x) Returns the mean of the given data set.static doublemean(double[] x, double[] weight) Returns the mean of the given data set with associated weights.static doublemedian(double[] x) Returns the median of the given data set.static doublemedian(double[] x, double[] weight) Returns the weighted median of the given data set and associated weights.static doubleminimum(double[] x) Returns the minimum of the given data set.protected static intminimum(int[] x) Returns the minimum of the given data set.static doublemode(double[] x) Returns the mode of the given data set.static intnumberOfObservations(double[] x) Returns the number of non-missing observations in the given data set.static doublequantile(double[] x, double[] weight, double alpha) static doublesampleStandardDeviation(double[] x) Returns the sample standard deviation of the given data set.static doublesampleStandardDeviation(double[] x, double[] weight) Returns the sample standard deviation of the given data set and associated weights.static doublesampleVariance(double[] x) Returns the sample variance of the given data set.static doublesampleVariance(double[] x, double[] weight) Returns the sample variance of the given data set and associated weights.static doubleskewness(double[] x) Returns the skewness of the given data set.static doubleskewness(double[] x, double[] weight) Returns the skewness of the given data set and associated weights.static doublestandardDeviation(double[] x) Returns the population standard deviation of the given data set.static doublestandardDeviation(double[] x, double[] weight) Returns the population standard deviation of the given data set and associated weights.voidupdate(double x) Adds an observation to theSummaryobject.voidupdate(double[] x) Adds a set of observations to theSummaryobject.voidupdate(double[] x, double[] weight) Adds a set of observations and associated weights to theSummaryobject.voidupdate(double x, double weight) Adds an observation and associated weight to theSummaryobject.static doublevariance(double[] x) Returns the population variance of the given data set.static doublevariance(double[] x, double[] weight) Returns the population variance of the given data set and associated weights.
-
Constructor Details
-
Summary
public Summary()Constructs a new summary statistics object.
-
-
Method Details
-
update
public void update(double x) Adds an observation to theSummaryobject.- Parameters:
x- adouble, the data observation to be added
-
update
public void update(double x, double weight) Adds an observation and associated weight to theSummaryobject.- Parameters:
x- adouble, the data observation to be addedweight- adouble, the weight associated with the observation
-
update
public void update(double[] x) Adds a set of observations to theSummaryobject.- Parameters:
x- adoublearray of data observations to be added
-
update
public void update(double[] x, double[] weight) Adds a set of observations and associated weights to theSummaryobject.- Parameters:
x- adoublearray of data observations to be addedweight- adoublearray of weights associated with the observations
-
getNumberOfObservations
public int getNumberOfObservations()Returns the number of non-missing observations.- Returns:
- an
int, the number of non-missing observations in theSummaryobject.
-
getMinimum
public double getMinimum()Returns the minimum.- Returns:
- a
doublerepresenting the minimum
-
getMaximum
public double getMaximum()Returns the maximum.- Returns:
- a
doublerepresenting the maximum
-
getMean
public double getMean()Returns the population mean.- Returns:
- a
doublerepresenting the population mean
-
getVariance
public double getVariance()Returns the population variance.- Returns:
- a
doublerepresenting the population variance
-
getSampleVariance
public double getSampleVariance()Returns the sample variance.- Returns:
- a
doublerepresenting the sample variance
-
getStandardDeviation
public double getStandardDeviation()Returns the population standard deviation.- Returns:
- a
doublerepresenting the population standard deviation
-
getSampleStandardDeviation
public double getSampleStandardDeviation()Returns the sample standard deviation.- Returns:
- a
doublerepresenting the sample standard deviation
-
getSkewness
public double getSkewness()Returns the skewness.- Returns:
- a
doublerepresenting the skewness
-
getKurtosis
public double getKurtosis()Returns the kurtosis.- Returns:
- a
doublerepresenting the kurtosis
-
confidenceMean
public double[] confidenceMean(double p) Returns the confidence interval for the mean (assuming normality).- Parameters:
p- adouble, the confidence level desired, usually 0.90, 0.95 or 0.99.- Returns:
- a
doublearray 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- adouble, the confidence level desired, usually 0.90, 0.95 or 0.99.- Returns:
- a
doublearray of length 2 which contains the lower and upper confidence limits for the variance
-
minimum
public static double minimum(double[] x) Returns the minimum of the given data set.- Parameters:
x- adoublearray containing the data set whose minimum is to be found.- Returns:
- a
double, the minimum of the given data set.
-
numberOfObservations
public static int numberOfObservations(double[] x) Returns the number of non-missing observations in the given data set.- Parameters:
x- adoublearray containing the data set.- Returns:
- an
int, the number of non-missing observations in the given data set.
-
minimum
protected static int minimum(int[] x) Returns the minimum of the given data set.- Parameters:
x- anintarray containing the data set whose minimum is to be found- Returns:
- an
int, the minimum of the given data set
-
maximum
public static double maximum(double[] x) Returns the maximum of the given data set.- Parameters:
x- adoublearray containing the data set whose maximum is to be found- Returns:
- a
double, the maximum of the given data set
-
maximum
protected static int maximum(int[] x) Returns the maximum of the given data set.- Parameters:
x- anintarray containing the data set whose maximum is to be found- Returns:
- an
int, the maximum of the given data set
-
mean
public static double mean(double[] x) Returns the mean of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose mean is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the mean of the given data set
-
variance
public static double variance(double[] x) Returns the population variance of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose population variance is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the population variance of the given data set
-
sampleVariance
public static double sampleVariance(double[] x) Returns the sample variance of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose sample variance is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the sample variance of the given data set
-
standardDeviation
public static double standardDeviation(double[] x) Returns the population standard deviation of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose standard deviation is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the population standard deviation of the given data set
-
sampleStandardDeviation
public static double sampleStandardDeviation(double[] x) Returns the sample standard deviation of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose sample standard deviation is to be foundweight- adoublearray containing the weights associated with the data points x.- Returns:
- a
double, the sample standard deviation of the given data set
-
skewness
public static double skewness(double[] x) Returns the skewness of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose skewness is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the skewness of the given data set
-
kurtosis
public static double kurtosis(double[] x) Returns the kurtosis of the given data set.- Parameters:
x- adoublearray 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- adoublearray containing the data set whose kurtosis is to be foundweight- adoublearray containing the weights associated with the data points x- Returns:
- a
double, the kurtosis of the given data set
-
median
public static double median(double[] x, double[] weight) Returns the weighted median of the given data set and associated weights.- Parameters:
x- adoublearray containing the data set whose median is to be foundweight- adoublearray containing the weights associated with the data- Returns:
- a
double, the weighted median of the given data set
-
quantile
public static double quantile(double[] x, double[] weight, double alpha) -
median
public static double median(double[] x) Returns the median of the given data set.- Parameters:
x- adoublearray containing the data set whose median is to be found- Returns:
- a
double, the median 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- adoublearray containing the data set whose mode is to be found- Returns:
- a
double, the mode of the given data set
-