2.13.1.13 mquantiles(Pro)

Brief Information

Compute quantiles on matrix data

Additional Information

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;

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 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 Mquantiles help English files image002.gif, Mquantiles help English files image004.gif

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

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

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

4. The interquartile range, or IQR, is calculated as Mquantiles 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, mstats, quantiles


Keywords:minimum, maximum, median, q1, q3