FirstPoint: Integer;
The FirstPoint property determines the starting point of the sample period.
This point is calculated starting from one.
By default, the property value is -1, in this case the value of the starting point of the sample period is defined automatically.
Sub Main;
Var
Exp: SmExponentialSmoothing;
Fact: Array Of Double;
Period: IStatPeriod;
r: Double;
i: Integer;
Begin
Exp := New SmExponentialSmoothing.Create;
Fact := New Double[9];
Debug.WriteLine("== Source series ==");
For i := 0 To 8 Do
Fact[i] := 1230 + i*302;
Debug.WriteLine(Fact[i]);
End For;
Exp.Serie.Value := Fact;
Period := Exp.ModelPeriod;
Period.FirstPoint := 0; // starting point of sample period
Period.LastPoint := 5; // the end point of sample period
Exp.Execute;
Debug.WriteLine("== Resulting series ==");
For i := 0 To Exp.Forecast.LastPoint - 1 Do
r := Exp.Fitted[i];
Debug.WriteLine(r.ToString);
End For;
End Sub Main;
After executing the example the console window displays the following result:
Module execution started
== Source series ==
1230
1532
1834
2136
2438
2740
3042
3344
3646
== Resulting series ==
2438
2317.2000000000003
2238.6800000000003
2198.2120000000004
2191.9908000000005
2216.5917200000004
2268.9325480000007
2346.2392932000007
2446.0153638800007
Module execution finished
See also: