ModelPeriod: IStatPeriod;
The ModelPeriod property determines sample period parameters.
Sub Main;
Var
Method: SmExponentialSmoothing;
serie: Array Of Double;
status: Integer;
Period: IStatPeriod;
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
Method := New SmExponentialSmoothing.Create;
serie := New Double[15];
serie[0] := 670.2000183;
serie[1] := 576.0680563;
serie[2] := 717.6484268;
serie[3] := 856.9105808;
serie[4] := 885.4609516;
serie[5] := 1011.846431;
serie[6] := 995.4496292;
serie[7] := 1064.74221;
serie[8] := 1033.324656;
serie[9] := 780.8584552;
serie[10] := 657.5033113;
serie[11] := 654.5472579;
serie[12] := 678.2380139;
serie[13] := 642.4128544;
serie[14] := 751.9611194;
Method.Serie.Value := serie;
Method.Forecast.LastPoint := 40;
Period := Method.ModelPeriod;
Period.FirstPoint := 4;
Period.LastPoint := 15;
Method.MissingData.Method := MissingDataMethod.LinInterpolation;
status := Method.Execute;
If status <> 0 Then
Debug.WriteLine(Method.Errors);
Else
Debug.WriteLine("=== Modeling series ===");
Print(Method.Fitted);
End If;
End Sub Main;
After executing the example the console window displays the following results:
Module execution started
=== Modeling series ===
---Begin---
0, ---empty---
1, ---empty---
2, ---empty---
3, 759,9877
4, 769,6800
5, 781,2581
6, 804,3169
7, 823,4302
8, 847,5614
9, 866,1377
10, 857,6098
11, 837,5992
12, 819,2940
13, 805,1884
14, 788,9108
---End---
Module execution finished
See also: