## 3.8.1 Basic Statistics

 Mean[list] mean (average) Median[list] median (central value) Max[list] maximum value Variance[list] variance StandardDeviation[list] standard deviation Quantile[list, q] q quantile Total[list] total

Basic descriptive statistics operations.

Given a list with elements , the mean Mean[list] is defined to be .

The variance Variance[list] is defined to be .

The standard deviation StandardDeviation[list] is defined to be .

If the elements in list are thought of as being selected at random according to some probability distribution, then the mean gives an estimate of where the center of the distribution is located, while the standard deviation gives an estimate of how wide the dispersion in the distribution is.

The median Median[list] effectively gives the value at the halfway point in the sorted version of list. It is often considered a more robust measure of the center of a distribution than the mean, since it depends less on outlying values.

The quantile Quantile[list, q] effectively gives the value that is of the way through the sorted version of list.

For a list of length , Mathematica defines Quantile[list, q] to be s[[Ceiling[n q]]], where s is Sort[list, Less].

There are, however, about ten other definitions of quantile in use, all potentially giving slightly different results. Mathematica covers the common cases by introducing four quantile parameters in the form Quantile[list, q, {{a, b}, {c, d}}]. The parameters and in effect define where in the list should be considered a fraction of the way through. If this corresponds to an integer position, then the element at that position is taken to be the quantile. If it is not an integer position, then a linear combination of the elements on either side is used, as specified by and .

The position in a sorted list for the quantile is taken to be . If is an integer, then the quantile is . Otherwise, it is , with the indices taken to be or if they are out of range.

 {{0, 0}, {1, 0}} inverse empirical CDF (default) {{0, 0}, {0, 1}} linear interpolation (California method) {{1/2, 0}, {0, 0}} element numbered closest to {{1/2, 0}, {0, 1}} linear interpolation (hydrologist method) {{0, 1}, {0, 1}} mean-based estimate (Weibull method) {{1, -1}, {0, 1}} mode-based estimate {{1/3, 1/3}, {0, 1}} median-based estimate {{3/8, 1/4}, {0, 1}} normal distribution estimate

Common choices for quantile parameters.

Whenever , the value of the quantile is always equal to some actual element in list, so that the result changes discontinuously as varies. For , the quantile interpolates linearly between successive elements in list. Median is defined to use such an interpolation.

Note that Quantile[list, q] yields quartiles when and percentiles when .

 Mean[{, , ... }] the mean of the Mean[{{, , ... }, {, , ... }, ... }] a list of the means of the , , ...

Handling multidimensional data.

Sometimes each item in your data may involve a list of values. The basic statistics functions in Mathematica automatically apply to all corresponding elements in these lists.

This separately finds the mean of each "column" of data.
 In[1]:=  Mean[{{x1, y1}, {x2, y2}, {x3, y3}}]
 Out[1]=

Note that you can extract the elements in the i "column" of a multidimensional list using list[[All, i]].

The standard set of packages distributed with Mathematica includes several for doing more sophisticated statistical analyses, as mentioned in Section 1.6.7.

THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.