This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Descriptive Statistics

Descriptive statistics refers to properties of distributions, such as location, dispersion, and shape. The functions described here compute descriptive statistics of lists of data. You can calculate some of the standard descriptive statistics for various known distributions by using the functions described in "Continuous Distributions" and "Discrete Distributions".
The statistics are calculated assuming that each value of data has probability equal to , where is the number of elements in the data.
Mean[data]average value
Median[data]median (central value)
Commonest[data]list of the elements with highest frequency
GeometricMean[data]geometric mean
HarmonicMean[data]harmonic mean
RootMeanSquare[data]root mean square
TrimmedMean[data,f]mean of remaining entries, when a fraction is removed from each end of the sorted list of data
TrimmedMean[data,{f1,f2}]mean of remaining entries, when fractions and are dropped from each end of the sorted data
Quantile[data,q]^(th) quantile
Quartiles[data]list of the ^(th), ^(th), ^(th) quantiles of the elements in list

Location statistics.

Location statistics describe where the data is located. The most common functions include measures of central tendency like the mean, median, and mode. Quantile gives the location before which percent of the data lie. In other words, Quantile gives a value such that the probability that is less than or equal to and the probability that is greater than or equal to .
Here is a dataset.
Click for copyable input
This finds the mean and median of the data.
Click for copyable input
This is the mean when the smallest entry in the list is excluded. TrimmedMean allows you to describe the data with removed outliers.
Click for copyable input
Variance[data]unbiased estimate of variance,
StandardDeviation[data]unbiased estimate of standard deviation
MeanDeviation[data]mean absolute deviation,
MedianDeviation[data]median absolute deviation, median of values
InterquartileRange[data]difference between the first and third quartiles
QuartileDeviation[data]half the interquartile range

Dispersion statistics.

Dispersion statistics summarize the scatter or spread of the data. Most of these functions describe deviation from a particular location. For instance, variance is a measure of deviation from the mean, and standard deviation is just the square root of the variance.
This gives an unbiased estimate for the variance of the data with as the divisor.
Click for copyable input
This compares three types of deviation.
Click for copyable input
Covariance[v1,v2]covariance coefficient between lists and
Covariance[m]covariance matrix for the matrix m
Covariance[m1,m2]covariance matrix for the matrices and
Correlation[v1,v2]correlation coefficient between lists and
Correlation[m]correlation matrix for the matrix m
Correlation[m1,m2]correlation matrix for the matrices and

Covariance and correlation statistics.

Covariance is the multivariate extension of variance. For two vectors of equal length, the covariance is a number. For a single matrix m, the ^(th) element of the covariance matrix is the covariance between the i^(th) and j^(th) columns of m. For two matrices and , the ^(th) element of the covariance matrix is the covariance between the i^(th) column of and the j^(th) column of .
While covariance measures dispersion, correlation measures association. The correlation between two vectors is equivalent to the covariance between the vectors divided by the standard deviations of the vectors. Likewise, the elements of a correlation matrix are equivalent to the elements of the corresponding covariance matrix scaled by the appropriate column standard deviations.
This gives the covariance between data and a random vector.
Click for copyable input
Here is a random matrix.
Click for copyable input
This is the correlation matrix for the matrix m.
Click for copyable input
This is the covariance matrix.
Click for copyable input
Scaling the covariance matrix terms by the appropriate standard deviations gives the correlation matrix.
Click for copyable input
CentralMoment[data,r]r^(th) central moment
Skewness[data]coefficient of skewness
Kurtosis[data]kurtosis coefficient
QuartileSkewness[data]quartile skewness coefficient

Shape statistics.

You can get some information about the shape of a distribution using shape statistics. Skewness describes the amount of asymmetry. Kurtosis measures the concentration of data around the peak and in the tails versus the concentration in the flanks.
Skewness is calculated by dividing the third central moment by the cube of the population standard deviation. Kurtosis is calculated by dividing the fourth central moment by the square of the population variance of the data, equivalent to CentralMoment. (The population variance is the second central moment, and the population standard deviation is its square root.)
QuartileSkewness is calculated from the quartiles of data. It is equivalent to , where , , and are the first, second, and third quartiles respectively.
Here is the second central moment of the data.
Click for copyable input
A negative value for skewness indicates that the distribution underlying the data has a long left-sided tail.
Click for copyable input
Expectation[f[x],xDistributedlist]expected value of the function f of x with respect to the values of list

Expected values.

The expectation or expected value of a function is for the list of values , , ..., . Many descriptive statistics are expectations. For instance, the mean is the expected value of , and the ^(th) central moment is the expected value of where is the mean of the .
Here is the expected value of the Log of the data.
Click for copyable input