dataFrame.column.stat — iqr()
Description
The iqr() method of the stat object returns quartile statistics and interquartile range (IQR) measures for the values in the selected column.
Signature
dataFrame.column(columnName).stat.iqr({ threshold: 1.5, sorted: false })Arguments
columnName(string)- The name of the column from which to calculate IQR statistics.
options(object)- Interquartile range options.
Options
threshold(number)- The IQR multiplier used to determine the lower and upper control limits. (Default:
1.5.) sorted(boolean)- Indicates whether the values are already sorted in ascending order.
- Sorted:
true - Not sorted:
false(default)
- Sorted:
Returns
stat(object)- An object containing the statistics:
q1(number)- First quartile
q2(number)- Median
q3(number)- Third quartile
iqr(number)- Interquartile range
lcl(number)- Lower control limit
ucl(number)- Upper control limit
mask(array)- An array assigning each value of the selected column to an IQR bucket.
Example
// get the IQR statistics for the values of a column of the dataFrame
var stat = dataFrame.column('revenue').stat.iqr();
// log stat details
notebook.log(stat);
// add IQR buckets to the dataFrame
dataFrame.column('IQR buckets').add(stat.mask);