Overload List
| # | Signature | Description |
|---|---|---|
| 1 | Double Percentile(TVec X, Double P, TPercentileMethod Method) | Percentile. |
| 2 | void Percentile(TVec X, Double[] P, ref Double[] Percentiles, TPercentileMethod Method) | Percentile (several percentiles in one go). |
Overload 1: Double Percentile(TVec X, Double P, TPercentileMethod Method)
Percentile.
| # | Name | Description |
|---|---|---|
| 1 | X | Data. An exception is raised if X is complex. |
| 2 | P | Defines the 100*p percentile. The parameter P must lie in the interval (0,1), otherwise an exception is raised. |
| 3 | 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. |
Returns: Double - the 100*P th percentile of all X vector elements. The 100*P -th percentile is defined as the value that is greater than 100*P percent of the values in X.
Examples
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
private void Example()
{
Vector a = new Vector(0);
double pctile;
a.SetIt(false, new double[] {1,2,3,10,15,21});
pctile = Statistics.Percentile(a,0.75,TPercentileMethod.pctMethodNPlus); // = 16.5
pctile = Statistics.Percentile(a,0.75, TPercentileMethod.pctMethodNMinus); // = 13.75
pctile = Statistics.Percentile(a,0.75,TPercentileMethod.pctMethodClosestN); // = 10
}
}
See Also: Statistics.InterQuartile
Overload 2: void Percentile(TVec X, Double[] P, ref Double[] Percentiles, TPercentileMethod Method)
Percentile (several percentiles in one go).
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TVec | source TVec |
| 2 | P | Double[] | |
| 3 | Percentiles | Double[] (ref) | |
| 4 | Method | TPercentileMethod |
Result: stored in self (calling object)
Remarks:
This overload calculates percentiles for all P elements in one pass. The advantage of this overload is X sample values only have to be sorted once.