ISmHodrickPrescottFilter.SummaryStatistics

Fore Syntax

SummaryStatistics: ISummaryStatistics;

Fore.NET Syntax

SummaryStatistics: Prognoz.Platform.Interop.Stat.ISummaryStatistics;

Description

The SummaryStatistics property returns summary statistics.

Fore Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    HP: SmHodrickPrescottFilter;
    s: Array Of Double;
    res: Integer;
    d: Double;
    Sub Print(Data: Array Of Double);
    Var
        i: Integer;
        CI: ICultureInfo;
    Begin
        CI := CultureInfo.Current;
        Debug.WriteLine("---Begin---");
        For i := 0 To Data.Length - 1 Do
            If Double.IsNan(Data[i]) Then
                Debug.WriteLine("---empty---");
            Else
                Debug.WriteLine(i.ToString + ". " + CI.FormatDoublePrec(Data[i], 4));
            End If;
        End For;
        Debug.WriteLine("---End---");
    End Sub Print;
Begin
    s := New Double[15];
    //values of s
    s[00] := 670.2; s[01] := 576.06; s[02] := 717.64;
    s[03] := 856.9; s[04] := 885.4; s[05] := 1011;
    s[06] := 995.44; s[07] := 1064.74; s[08] := 1033.3;
    s[09] := 780.8; s[10] := 657.5; s[11] := 654.5;
    s[12] := 678.23; s[13] := 642.41; s[14] := 751.9;
    HP := New SmHodrickPrescottFilter.Create;
    HP.Serie.Value := s;
    HP.ModelPeriod.FirstPoint := 1;
    HP.ModelPeriod.LastPoint := 15;
    HP.MissingData.Method := MissingDataMethod.SampleAverage;
    HP.SmoothingParameter := 10;
    res := HP.Execute;
    If res <> 0 Then
        Debug.WriteLine(HP.Errors);
    Else
        Debug.WriteLine("Summary statistics");
        d := HP.SummaryStatistics.SEE;
        Debug.WriteLine("  - standard deviation of residuals: " + d.ToString);
        d := HP.SummaryStatistics.ME;
        Debug.WriteLine("  - mean error: " + d.ToString);
        Debug.WriteLine("Residuals");
        Print(HP.Residuals);
    End If;
End Sub UserProc;

After executing the example summary statistics and a residual series are displayed in the console window.

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 Print(Data: System.Array);
Var
    i: Integer;
Begin
    System.Diagnostics.Debug.WriteLine("---Begin---");
    For i := 0 To Data.Length - 1 Do
        If Double.IsNan(Data.GetValue(i) As Double) Then
            System.Diagnostics.Debug.WriteLine("---empty---");
        Else
            System.Diagnostics.Debug.WriteLine(i.ToString() + ". " + Data.GetValue(i).ToString());
        End If;
    End For;
    System.Diagnostics.Debug.WriteLine("---End---");
End Sub Print;
    
Public Shared Sub Main(Params: StartParams);
Var
    HP: SmHodrickPrescottFilter;
    s: Array Of Double;
    res: Integer;
    d: Double;
Begin
    s := New Double[15];
    // Set variable values
    s[00] := 670.2; s[01] := 576.06; s[02] := 717.64;
    s[03] := 856.9; s[04] := 885.4; s[05] := 1011;
    s[06] := 995.44; s[07] := 1064.74; s[08] := 1033.3;
    s[09] := 780.8; s[10] := 657.5; s[11] := 654.5;
    s[12] := 678.23; s[13] := 642.41; s[14] := 751.9;
    HP := New SmHodrickPrescottFilter.Create();
    HP.Serie.Value := s;
    // Set sample period
    HP.ModelPeriod.FirstPoint := 1;
    HP.ModelPeriod.LastPoint := 15;
    // Specify missing data treatment method
    HP.MissingData.Method := MissingDataMethod.mdmSampleAverage;
    // Set smoothing parameter
    HP.SmoothingParameter := 10;
    // Calculate the method  and output the results
    res := HP.Execute();
    If res <> 0 Then
        System.Diagnostics.Debug.WriteLine(HP.Errors);
    Else
        System.Diagnostics.Debug.WriteLine("Summary statistics");
        d := HP.SummaryStatistics.SEE;
        System.Diagnostics.Debug.WriteLine("  - standard deviation of residuals: " + d.ToString());
        d := HP.SummaryStatistics.ME;
        System.Diagnostics.Debug.WriteLine("  - mean error: " + d.ToString());
        System.Diagnostics.Debug.WriteLine("Residuals");
        Print(HP.Residuals);
    End If;
End Sub;

See also:

ISmHodrickPrescottFilter