WarningByStatus(Status: Integer): String;
WarningByStatus[Status: integer]: string;
Status. Warning number.
The WarningByStatus property returns a warning text by its number.
The array that contains numbers of warnings occurred at the method runtime is returned with the IStatMethod.WarningsNumbers property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
HP: SmHodrickPrescottFilter;
s: Array[15] Of Double;
res: Integer;
j, n: Integer;
Begin
// Set values for variables
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;
//Set source series
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;
// Determine number of periods in the year
HP.Frequency := 12;
// Determine method of setting smoothing parameter
HP.SmoothingParameterMode := HPSmoothingParameterModeType.EditDirectly;
// Set smoothing parameter
HP.SmoothingParameter := 5000000000000000000;
// Execute calculation and display results
res := HP.Execute;
If res <> 0 Then
Debug.WriteLine(HP.Errors);
Else
If HP.WarningsCount > 0 Then
Debug.WriteLine("Warnings");
For j := 0 To HP.WarningsNumbers.Length - 1 Do
n := HP.WarningsNumbers[j];
Debug.WriteLine(HP.WarningByStatus(n));
End For;
End If;
Debug.WriteLine("Modeling series");
For j := 0 To HP.Fitted.Length - 1 Do
Debug.WriteLine(HP.Fitted[j]);
End For;
End If;
End Sub UserProc;
After executing the example the console window displays the modeling series and the warnings that occurred at the method calculation.
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
HP: SmHodrickPrescottFilter;
s: Array[15] Of Double;
res: Integer;
j, n: Integer;
Begin
// Set values for variables
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();
//Set source series
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;
// Determine number of periods in the year
HP.Frequency := 12;
// Determine method of setting smoothing parameter
HP.SmoothingParameterMode := HPSmoothingParameterModeType.hpspmtEditDirectly;
// Set smoothing parameter
HP.SmoothingParameter := 5000000000000000000;
// Execute calculation and display results
res := HP.Execute();
If res <> 0 Then
System.Diagnostics.Debug.WriteLine(HP.Errors);
Else
If HP.WarningsCount > 0 Then
System.Diagnostics.Debug.WriteLine("Warnings");
For j := 0 To HP.WarningsNumbers.Length - 1 Do
n := HP.WarningsNumbers.GetValue(j) As integer;
System.Diagnostics.Debug.WriteLine(HP.WarningByStatus[n]);
End For;
End If;
System.Diagnostics.Debug.WriteLine("Modeling series");
For j := 0 To HP.Fitted.Length - 1 Do
System.Diagnostics.Debug.WriteLine(HP.Fitted.GetValue(j));
End For;
End If;
End Sub;
See also: