Phi: Double;
Phi: double;
The Phi property determines value of phi parameter.
Default property value is 0.10.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
Method: SmExponentialSmoothing;
serie: Array Of Double;
status: Integer;
Params: IExponentialSmoothingParameters;
Seasonal: ISeasonal;
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(i.ToString + ",---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;
// Set series
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;
// Set last forecast point
Method.Forecast.LastPoint := 40;
// Determine seasonality type and period
Seasonal := Method.SeasonalComponent;
Seasonal.Mode := SeasonalityType.Additive;
Seasonal.Cycle := 4;
// Determine model trend type
Method.TrendComponent := TrendType.Linear;
// Set parameters
Params := Method.Parameters;
Params.Alpha := 0.15;
Params.Delta := 0.2;
Params.Phi := 0.15;
// Start calculation and output modeling series
status := Method.Execute;
If status <> 0 Then
Debug.WriteLine(Method.Errors);
Else
Debug.WriteLine("=== Model series ===");
Print(Method.Fitted);
End If;
End Sub UserProc;
After executing the example the console window displays the calculated modeling series.
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
Method: SmExponentialSmoothing;
serie: Array Of Double;
status: Integer;
Params_a: IExponentialSmoothingParameters;
Seasonal: ISeasonal;
Begin
Method := New SmExponentialSmoothing.Create();
// Set series
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;
// Set last forecast point
Method.Forecast.LastPoint := 40;
// Determine seasonality type and seasonal period
Seasonal := Method.SeasonalComponent;
Seasonal.Mode := SeasonalityType.sstAdditive;
Seasonal.Cycle := 4;
// Determine model trend type
Method.TrendComponent := TrendType.tdtLinear;
// Set parameters
Params_a := Method.Parameters;
Params_a.Alpha := 0.15;
Params_a.Delta := 0.2;
Params_a.Phi := 0.15;
// Start calculation and output modeling series
status := Method.Execute();
If status <> 0 Then
System.Diagnostics.Debug.WriteLine(Method.Errors);
Else
System.Diagnostics.Debug.WriteLine("=== Modeling series ===");
Print(Method.Fitted);
End If;
End Sub;
Public Shared Sub Print(Data: System.Array);
Var
i: Integer;
Begin
System.Diagnostics.Debug.WriteLine("---Begin---");
For i := 0 To Data.Length - 1 Do
If Double.IsNan(Data[i] As double) Then
System.Diagnostics.Debug.WriteLine("---empty---");
Else
System.Diagnostics.Debug.WriteLine(i.ToString() + ", " + Data[i]);
End If;
End For;
System.Diagnostics.Debug.WriteLine("---End---");
End Sub Print;
See also: