Forecast: IForecast;
The Forecast property determines forecasting series parameters.
Sub Main;
Var
GExtra: SmGeometricExtrapolation;
s: Array Of Double;
res: Integer;
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];
// s values
s[00] := 6209;
s[01] := 6385;
s[02] := 6752;
s[03] := 6837;
s[04] := 6495;
s[05] := 6907;
s[06] := 7349;
s[07] := 7213;
s[08] := 7061;
s[09] := 7180;
s[10] := 7132;
s[11] := 7137;
s[12] := 7473;
s[13] := 7722;
s[14] := 8088;
GExtra := New SmGeometricExtrapolation.Create;
GExtra.Serie.Value := s;
GExtra.MissingData.Method := MissingDataMethod.Casewise;
GExtra.ModelPeriod.FirstPoint := 1;
GExtra.ModelPeriod.LastPoint := 14;
GExtra.Forecast.LastPoint := 20;
res := GExtra.Execute;
If res <> 0 Then
Debug.WriteLine(GExtra.Errors);
Else
Debug.WriteLine("Forecast");
Print(GExtra.Forecast.Value);
End If;
End Sub Main;
After executing the example the console window displays forecasting series:
Module execution started
Forecast
---Begin---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
---empty---
14, 7 916.0116
15, 8 054.5457
16, 8 195.5042
17, 8 338.9295
18, 8 484.8648
19, 8 633.3541
---End---
Module execution finished
See also: