public class Summary extends Object implements 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 ) $$)
Constructor and Description |
---|
Summary()
Constructs a new summary statistics object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getNumberOfObservations()
Returns the number of non-missing observations.
|
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.
|
protected static int |
maximum(int[] 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 |
median(double[] x,
double[] weight)
Returns the weighted median of the given data set and associated weights.
|
static double |
minimum(double[] x)
Returns the minimum of the given data set.
|
protected static int |
minimum(int[] x)
Returns the minimum of the given data set.
|
static double |
mode(double[] x)
Returns the mode of the given data set.
|
static int |
numberOfObservations(double[] x)
Returns the number of non-missing observations in the given data set.
|
static double |
quantile(double[] x,
double[] weight,
double alpha) |
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.
|
public void update(double x)
Summary
object.x
- a double
, the data observation to be addedpublic void update(double x, double weight)
Summary
object.x
- a double
, the data observation to be addedweight
- a double
, the weight associated with the observationpublic void update(double[] x)
Summary
object.x
- a double
array of data observations to be addedpublic void update(double[] x, double[] weight)
Summary
object.x
- a double
array of data observations to be addedweight
- a double
array of weights associated with the observationspublic int getNumberOfObservations()
int
, the number of non-missing
observations in the Summary
object.public double getMinimum()
double
representing the minimumpublic double getMaximum()
double
representing the maximumpublic double getMean()
double
representing the population meanpublic double getVariance()
double
representing the population variancepublic double getSampleVariance()
double
representing the sample variancepublic double getStandardDeviation()
double
representing the population
standard deviationpublic double getSampleStandardDeviation()
double
representing the
sample standard deviationpublic double getSkewness()
double
representing the skewnesspublic double getKurtosis()
double
representing the kurtosispublic double[] confidenceMean(double p)
p
- a double
, the confidence level desired, usually
0.90, 0.95 or 0.99.double
array of length 2 which contains
the lower and upper confidence limits for the meanpublic double[] confidenceVariance(double p)
p
- a double
, the confidence level desired, usually
0.90, 0.95 or 0.99.double
array of length 2 which contains
the lower and upper confidence limits for the variancepublic static double minimum(double[] x)
x
- a double
array containing the data set whose
minimum is to be found.double
, the minimum of the given data set.public static int numberOfObservations(double[] x)
x
- a double
array containing the data set.int
, the number of non-missing
observations in the given data set.protected static int minimum(int[] x)
x
- an int
array containing the data set whose
minimum is to be foundint
, the minimum of the given data setpublic static double maximum(double[] x)
x
- a double
array containing the data set whose
maximum is to be founddouble
, the maximum of the given data setprotected static int maximum(int[] x)
x
- an int
array containing the data set whose
maximum is to be foundint
, the maximum of the given data setpublic static double mean(double[] x)
x
- a double
array containing the data set whose
mean is to be founddouble
, the mean of the given data setpublic static double mean(double[] x, double[] weight)
x
- a double
array containing the data set whose
mean is to be foundweight
- a double
array containing the weights
associated with the data points xdouble
, the mean of the given data setpublic static double variance(double[] x)
x
- a double
array containing the data set whose
population variance is to be founddouble
, the population variance of the given
data setpublic static double variance(double[] x, double[] weight)
x
- a double
array containing the data set whose
population variance is to be foundweight
- a double
array containing the weights associated
with the data points xdouble
, the population variance of the given
data setpublic static double sampleVariance(double[] x)
x
- a double
array containing the data set whose
sample variance is to be founddouble
, the sample variance of the given
data setpublic static double sampleVariance(double[] x, double[] weight)
x
- a double
array containing the data set whose
sample variance is to be foundweight
- a double
array containing the weights associated
with the data points xdouble
, the sample variance of the given
data setpublic static double standardDeviation(double[] x)
x
- a double
array containing the data set whose
standard deviation is to be founddouble
, the population standard deviation of the given
data setpublic static double standardDeviation(double[] x, double[] weight)
x
- a double
array containing the data set whose
standard deviation is to be foundweight
- a double
array containing the weights associated with
the data points xdouble
, the population standard deviation of the given
data setpublic static double sampleStandardDeviation(double[] x)
x
- a double
array containing the data set whose
sample standard deviation is to be founddouble
, the sample standard deviation of the given
data setpublic static double sampleStandardDeviation(double[] x, double[] weight)
x
- a double
array containing the data set whose
sample standard deviation is to be foundweight
- a double
array containing the weights associated
with the data points x.double
, the sample standard deviation of the given
data setpublic static double skewness(double[] x)
x
- a double
array containing the data set whose
skewness is to be founddouble
, the skewness of the given
data setpublic static double skewness(double[] x, double[] weight)
x
- a double
array containing the data set whose
skewness is to be foundweight
- a double
array containing the weights associated
with the data points xdouble
, the skewness of the given
data setpublic static double kurtosis(double[] x)
x
- a double
array containing the data set whose
kurtosis is to be founddouble
, the kurtosis of the given
data setpublic static double kurtosis(double[] x, double[] weight)
x
- a double
array containing the data set whose
kurtosis is to be foundweight
- a double
array containing the weights associated
with the data points xdouble
, the kurtosis of the given
data setpublic static double median(double[] x, double[] weight)
x
- a double
array containing the data set whose
median is to be foundweight
- a double
array containing the weights
associated with the datadouble
, the weighted median of the given
data setpublic static double quantile(double[] x, double[] weight, double alpha)
public static double median(double[] x)
x
- a double
array containing the data set whose
median is to be founddouble
, the median of the given
data setpublic static double mode(double[] x)
x
- a double
array containing the data set whose
mode is to be founddouble
, the mode of the given
data setCopyright © 2020 Rogue Wave Software. All rights reserved.