# 2.13.1.13 mquantiles(Pro)

## Brief Information

Compute quantiles on matrix data

This feature is for OriginPro only.

## Command Line Usage

 

1. mquantiles im:=MBook1; 

2. mquantiles im:=MBook1 median:=mymedian; 

3. mquantiles im:=MBook1 x1:=r1 y1:=c1 x2:=r2 y2:=c2; 

## Variables

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

Input

MatrixObject

<active>

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

Minimum min

Output

double

<unassigned>

This variable specifies the output for the minimum value of the matrix.

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 of the matrix.

Interquartile Range iqr

Output

double

<unassigned>

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

Index of Minimum X x1

Output

double

<unassigned>

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

Index of Minimum Y y1

Output

double

<unassigned>

This variable specifies the output for the column index of the minimum value in the matrix.

Index of Maximum X x2

Output

double

<unassigned>

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

Index of Maximum Y y2

Output

double

<unassigned>

This variable specifies the output for the column index of the maximum value in the matrix.

## 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.

The X-function of mquantiles is used to compute the quantiles of the Matrix object. It can give out the basic aspects of the Matrix. For example, it can output the minimum, maximum, 1st quartile, median, 3rd quartile and interquartiles range. From these statistics, you can know the general distributional information of the specified Matrix.

## Examples

### Example 1

1. Active a Matrix.
2. From the menu, select Matrix: Set Values and open the dialog.
3. Type the following code in the Edit box
sin(i)+cos(j)
4. Click OK button.
5. Type the following command in the Script Window:
 mquantiles;
6. Click Enter.
7. Then you can run
mquantiles.=;

to get the basic information of the Matrix, such as minimum, maximum, 1st quartile, median, 3rd quartile and interquartiles range.

### Example 2

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

win -t m;
wks.ncols=5;
wks.nrows=5;
matrix -v i*j;
mquantiles im:=MBook1 min:=zmin max:=zmax x1:=r1 y1:=c1 x2:=r2 y2:=c2;
zmin=;
zmax=;
r1=;
r2=;
c1=;
c2=;

## Algorithm

Sort given data first. Denote the sorted data range as ,

1. The 1st quartile is computed as , where is the integer part, and is the fractional part of equation

2. The median, or 2nd quartile, is computed as , where is the integer part, and is the fractional part of equation

3. 3rd quartile is computed as , where is the integer part, and is the fractional part of equation

4. The interquartile range, or IQR, is calculated as

## References

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

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

## Related X-Functions

Keywords:minimum, maximum, median, q1, q3