You are here: Symbol Reference > Statistics Namespace > Functions > Statistics.InterQuartile Function
Stats Master VCL
ContentsIndex
PreviousUpNext
Statistics.InterQuartile Function

InterQuartile range.

Pascal
function InterQuartile(const X: TVec; Method: TPercentileMethod = pctMethodNPlus): double;
Parameters 
Description 
Data. An exception is raised if X is complex. 
Method 
Defines one of the available methods for calculating percentile. Software packages use different methods to calculate percentiles. For example, Excel uses pctMethodNMinus, while on the other hand, NCSS's default method is pctMethodNPlus. 

the interquartile range of all X vector elements. The interquartile range is defined as a difference between 75th percentile and 25th percentile of given values.

Calculate the IQR for given values.

Uses MtxExpr, Statistics, Math387;
function Example: double;
var a: Vector;
    Res: double;
begin
    a.Size(4);
    a.SetIt([2,0.1,3,4]);
    Result := InterQuartile(a, TPercentileMethod.pctMethodNMinus); // Res = 1.725  //Excel convention
end;
end;
#include "MtxExpr.hpp"
#include "Statistics.hpp"
#include "Math387.hpp"
void __fastcall Example()
{
    sVector a;
    a.SetIt(false, OPENARRAY(double,(2,0.1,3,4)));
    double res = InterQuartile(a,pctMethodNMinus); // Res = 1.725  //Excel convention
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!