PercentileDcml(Data: Array; Percent: Double): Decimal;
PercentileDcml(Data: System.Array; Percent: double): decimal;
Data. An array of decimal high-precision numbers, which determines relative position.
Percent. Percentile value. Valid values lie in the range: [0; 1].
The PercentileDcml method returns the k-th percentile for values of the Decimal type from the set interval.
Percentile is used to determine sustainability threshold. If k is not divisible by 1/(n - 1), the Percentile function performs interpolation to calculate the k-th percentile value.
To define numbers of the Decimal type in the array, it is necessary to write the "m" character after the value of each number. For example: 0.001m.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
st: Statistics;
a: Array[5] Of Variant;
s: Decimal;
Begin
st := New Statistics.Create;
a[0] := 0.85m;
a[1] := 0.14m;
a[2] := 0.53m;
a[3] := 0.28m;
a[4] := 0.31m;
s:=st.PercentileDcml(a, 0.3);
Debug.WriteLine("30-th percentile: " + s.ToString);
End Sub UserProc;
After executing the example the console window displays the 30-th percentile for the specified data array.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
st: Statistics;
a: Array[5] Of object;
s: decimal;
Begin
st := New Statistics.Create();
a[0] := 0.85m;
a[1] := 0.14m;
a[2] := 0.53m;
a[3] := 0.28m;
a[4] := 0.31m;
s:=st.PercentileDcml(a, 0.3);
System.Diagnostics.Debug.WriteLine("30-th percentile: " + s.ToString());
End Sub;
See also: