ISmQPortions.Samples

Fore Syntax

Samples: Array;

Fore.NET Syntax

Samples: System.Array;

Description

The Samples property determines a source sample, which is used to calculate the median, quartiles, percentiles and deciles.

Comments

Array indexing with a source sampling must start with zero.

Fore Example

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

Sub UserProc;
Var
    SQ: SmQPortions;
    can, y: Array Of Double;
    res, i: Integer;
    m: Double;
Begin
    SQ := New SmQPortions.Create;
    can := New Double[16];
    can[00] := 6209;
    can[01] := 6385;
    can[02] := 6752;
    can[03] := 6837;
    can[04] := 6495;
    can[05] := 6907;
    can[06] := 7349;
    can[07] := 7213;
    can[08] := 7061;
    can[09] := 7180;
    can[10] := 7132;
    can[11] := 7137;
    can[12] := 7473;
    can[13] := 7722;
    can[14] := 8088;
    can[15] := 8516;
    SQ.Samples := can;
    res := SQ.Execute;
    If res <> 0 Then
        Debug.WriteLine(SQ.Errors);
        Else
            Debug.WriteLine("== Median ==");
            m := SQ.Median;
            Debug.WriteLine(m);
            Debug.WriteLine("== Deciles ==");
            y := SQ.Deciles;
            For i := 0 To y.Length - 1 Do
                m := y[i];
                Debug.WriteLine(i.ToString + " " + m.ToString);
            End For;
    End If;
End Sub UserProc;

Executing this example shows a median and deciles in the console window:

== Median ==

7213

== Deciles ==

0 6209

1 6440

2 6752

3 6872

4 7061

5 7134.5

6 7180

7 7281

8 7473

9 7905

10 8516

Fore.NET Example

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
    SQ: SmQPortions;
    can: Array[16Of Double;
    y: System.Array;
    res, i: Integer;
    m: Double;
Begin
    SQ := New SmQPortions.Create();
    can[00] := 6209;
    can[01] := 6385;
    can[02] := 6752;
    can[03] := 6837;
    can[04] := 6495;
    can[05] := 6907;
    can[06] := 7349;
    can[07] := 7213;
    can[08] := 7061;
    can[09] := 7180;
    can[10] := 7132;
    can[11] := 7137;
    can[12] := 7473;
    can[13] := 7722;
    can[14] := 8088;
    can[15] := 8516;
    SQ.Samples := can;
    res := SQ.Execute();
    If res <> 0 Then
        System.Diagnostics.Debug.WriteLine(SQ.Errors);
        Else
            System.Diagnostics.Debug.WriteLine("== Median ==");
            m := SQ.Median;
            System.Diagnostics.Debug.WriteLine(m);
            System.Diagnostics.Debug.WriteLine("== Deciles ==");
            y := SQ.Deciles;
            For i := 0 To y.Length - 1 Do
                m := y[i] As double;
                System.Diagnostics.Debug.WriteLine(i.ToString() + " " + m.ToString());
            End For;
    End If;
End Sub;

See also:

ISmQPortions