2.13.1.17 quantiles

Brief Information

Compute quantiles on worksheet columns

Command Line Usage

1. quantiles ix:=Col(1);

2. quantiles ix:=Col(1) median:=mymedian;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input ix

Input

vector

<active>

This variable specifies the range of input data for which quantiles will be calculated.

Minimum min

Output

double

<unassigned>

This variable specifies the output for the minimum value of the data set.

Q1 q1

Output

double

<unassigned>

This variable specifies the output for the 1st quartile, that is, the value in a dataset that demarcates the lowest 25% of the values in an ordered set.

Median median

Output

double

<unassigned>

This variable specifies the output for the median or 2nd quartile, that is, the value in a dataset that demarcates the lowest 50% of the values in an ordered set.

Q3 q3

Output

double

<unassigned>

This variable specifies the output for the 3rd quartile, that is, the value in a dataset that demarcates the lowest 75% of the values in an ordered set.

Maximum max

Output

double

<unassigned>

This variable specifies the output for the maximum value.

Interquartile Range iqr

Output

double

<unassigned>

This variable specifies the output for the interquartile range (IQR), that is, Q3 -Q1.

Index of Minimum i1

Output

double

<unassigned>

This variable specifies the output for the row index of the minimum value in the dataset.

Index of Maximum i2

Output

double

<unassigned>

This variable specifies the output for the row index of the maximum value in the dataset.

Description

quantiles are values from the data below which lie a given proportion of the data points in a given set. For example, 25% of data points in any set of data lay below the first quartile, and 50% of data points in a set lay below the second quartile, or median. When data is divided into 100 parts, percentiles can be calculated.

This analysis can give the basic information of the data, such as the minimum, maximum, 1st quartile, median, 3rd quartile and the interquartile range.

Examples

Example 1

  1. Highlight the 1st column of the active dataset
  2. Right click the mouse and select fill column with: normal random numbers.
  3. Type
    quantiles

    in the command window. Press Enter.

  4. Then you can run
    quantiles.=

    to get the basic information about the data you specified, such as minimum, maximum, 1st quantile, median, 3rd quantile and interquantile range.

Example 2

The following script will get the minimum and maximum values and the corresponding row indices.

win -t wks;
string fn$=system.path.program$ + "Samples\graphing\group.dat"; 
impasc fname:=fn$; 
quantiles ix:=Col(1) max:=mymax min:=mymin i1:=a1 i2:=a2;
mymax=;
mymin=;
a1=;
a2=;

Algorithm

Sort given data first. Denote the sorted data range as Quantiles help English files image002.gif, Quantiles help English files image004.gif

1. The 1st quartile is computed as Quantiles help English files image006.gif, where Quantiles help English files image008.gif is the integer part, and Quantiles help English files image010.gifis the fractional part of equation Quantiles help English files image012.gif

2. The median, or 2nd quartile, is computed as Quantiles help English files image006.gif, where Quantiles help English files image008.gif is the integer part, and Quantiles help English files image010.gifis the fractional part of equation Quantiles help English files image014.gif

3. 3rd quartile is computed as Quantiles help English files image006.gif, where Quantiles help English files image008.gif is the integer part, and Quantiles help English files image010.gifis the fractional part of equation Quantiles help English files image016.gif

4. The interquartile range, or IQR, is calculated as Quantiles help English files image018.gif

References

David, H. A. 1981. Order Statistics. 2nd ed. Wiley, New York.

Tukey, J.W. Exploratory Data Analysis. Addison-Wesley, 1977.

Related X-Functions

stats, moments, rowquantiles, rowstats, mquantiles


Keywords:minimum, maximum, median, q1, q3