ISmHodrickPrescottFilter.SmoothingParameterMode

Fore Syntax

SmoothingParameterMode: HPSmoothingParameterModeType;

Fore.NET Syntax

SmoothingParameterMode: Prognoz.Platform.Interop.Stat.HPSmoothingParameterModeType;

Description

The SmoothingParameterMode property determines the method of setting the smoothing parameter.

Comments

The following values are available for SmoothingParameterMode:

Fore Example

Add a link to the Stat system assembly.

Sub Print(Data: Array Of Double);
Var
    i: Integer;
Begin
    For i := 0 To Data.Length - 1 Do
        If Double.IsNan(Data[i]) Then
            Debug.WriteLine("----empty---");
            Else
                Debug.WriteLine(i.ToString + " " + Data[i].ToString);
        End If;
    End For;
End Sub Print;
    
Sub UserProc;
Var
    HP: SmHodrickPrescottFilter;
    s: Array Of Double;
    res: Integer;
Begin
    s := New Double[15];
    // Set variable values
    s[00] := 670.2; s[08] := 1033.3;
    s[01] := 576.06; s[09] := 780.8;
    s[02] := 717.64; s[10] := 657.5;
    s[03] := 856.9; s[11] := 654.5;
    s[04] := 885.4; s[12] := 678.23;
    s[05] := 1011; s[13] := 642.41;
    s[06] := 995.44; s[14] := 751.9;
    s[07] := 1064.74;
    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.SampleAverage;
    // Set  number of periods in the year
    HP.Frequency := 12;
    // Determine method of setting smoothing parameter
    HP.SmoothingParameterMode := HPSmoothingParameterModeType.SetByFrequencyRule;
    // Set power value
    HP.Power := 5;
    // Calculate the method  and output the results
    res := HP.Execute;
    If res <> 0 Then
        Debug.WriteLine(HP.Errors);
    Else
        Debug.WriteLine("Modeling series");
        Print(HP.Fitted);
    End If;
End Sub UserProc;

After executing the example the console window displays a modeling series. Calculations are based on monthly data, smoothing parameter is determined by power value.

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
    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;
End Sub Print;

Public Shared Sub Main(Params: StartParams);
Var
    HP: SmHodrickPrescottFilter;
    s: Array Of Double;
    res: Integer;
Begin
    s := New Double[15];
    // Set variable values
    s[00] := 670.2; s[08] := 1033.3;
    s[01] := 576.06; s[09] := 780.8;
    s[02] := 717.64; s[10] := 657.5;
    s[03] := 856.9; s[11] := 654.5;
    s[04] := 885.4; s[12] := 678.23;
    s[05] := 1011; s[13] := 642.41;
    s[06] := 995.44; s[14] := 751.9;
    s[07] := 1064.74;
    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  number of periods in the year
    HP.Frequency := 12;
    // Determine method of setting smoothing parameter
    HP.SmoothingParameterMode := HPSmoothingParameterModeType.hpspmtSetByFrequencyRule;
    // Set power value
    HP.Power := 5;
    // 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("Modeling series");
        Print(HP.Fitted);
    End If;
End Sub;

See also:

ISmHodrickPrescottFilter