Calculate the 2nd quantile location = median position.
Uses MtxExpr, Math387, Statistics; procedure Example; var a: Vector; PrcRes: double; begin a.SetIt(false,[1, 2, 3, 10, 15, 21]); PrcRes := Percentile(a,0.75); // PrcRes = 16.5 PrcRes := Percentile(a,0.75, pctMethodNMinus); // PrcRes = 13.75 PrcRes := Percentile(a,0.75,pctMethodClosestN); // PrcRes = 10 end;
#include "MtxExpr.hpp" #include "Math387.hpp" #include "Statistics.hpp" void __fastcall Example() { sVector a; double pctile; a.SetIt(false,OPENARRAY(double,(1,2,3,10,15,21))); pctile = Percentile(a,0.75,pctMethodNPlus); // = 16.5 pctile = Percentile(a,0.75, pctMethodNMinus); // = 13.75 pctile = Percentile(a,0.75,pctMethodClosestN); // = 10 }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|