Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

Measures of Shape

Quantiles and percentiles provide information about the shape of data as well as its location and spread.

The quantile of order p (0 ≤ p ≤ 1) is the smallest x value where the cumulative distribution function equals or exceeds p. The function quantile computes quantiles as follows:

  1. n sorted data points are the 0.5/n, 1.5/n, ..., (n–0.5)/n quantiles.

  2. Linear interpolation is used to compute intermediate quantiles.

  3. The data min or max are assigned to quantiles outside the range.

  4. Missing values are treated as NaN, and removed from the data.

Percentiles, computed by the prctile function, are quantiles for a certain percentage of the data, specified for 0 ≤ p ≤ 100.

The following example shows the result of looking at every quartile (quantiles with orders that are multiples of 0.25) of a sample containing a mixture of two distributions.

x = [normrnd(4,1,1,100) normrnd(6,0.5,1,200)];
p = 100*(0:0.25:1);
y = prctile(x,p);
z = [p;y]
z =
         0   25.0000   50.0000   75.0000  100.0000
    1.8293    4.6728    5.6459    6.0766    7.1546

A box plot helps to visualize the statistics:

boxplot(x)

The long lower tail and plus signs show the lack of symmetry in the sample values. For more information on box plots, see Box Plots.

The shape of a data distribution is also measured by the Statistics Toolbox functions skewness, kurtosis, and, more generally, moment.

  


 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS