IStatistics.Frequency

Syntax

Frequency(DataArray: Array; BinsArray: Array): Array;

Parameters

DataArray. Array of data frequency of which should be calculated. If DataArray contains no values, the Frequency function returns an array of zeroes.

BinsArray. Array of intervals in which values of DataArray argument are grouped. If BinsArray contains no values, the Frequency function returns the number of elements in DataArray argument.

Description

The Frequency method calculates the frequency of value occurrences in a value range and returns a number array.

Comments

The number of elements in a returned array is one element greater than the number of elements in the BinsArray array. The number of values contained in an additional element from a returned array is greater than the maximum value in the intervals.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    st: Statistics;
    d0: Double;
    y, x: Array Of Double;
    i: Integer;
    res: Array Of Integer;
Begin
    y := New Double[9];
    x := New Double[3];
    y[00] := 79; x[00] := 70;
    y[01] := 85; x[01] := 79;
    y[02] := 78; x[02] := 89;
    y[03] := 85;
    y[04] := 50;
    y[05] := 81;
    y[06] := 95;
    y[07] := 88;
    y[08] := 97;
    st := New Statistics.Create;
    res := st.Frequency(y, x);
    If st.Status <> 0 Then
        Debug.WriteLine(st.Errors);
    Else
        For i := 0 To res.Length - 1 Do
            d0 := res[i];
            Debug.WriteLine(d0.ToString);
        End For;
    End If;
End Sub UserProc;

Executing this example shows the resulting array in the console window:

Module execution started

1

1

5

2

Module execution finished

Where:

1 - the number of y array values which fall within the first range [70 and less).

1 - the number of y array values which fall within the second range [71-79).

5 - the number of y array values which fall within the third range [79-89).

2 - the number of y array values which exceed the limit value of the third range [89 and greater).

See also:

IStatistics | Frequency