SummaryStatistics: ISummaryStatistics;
The SummaryStatistics property returns summary statistics.
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.
See also: