InitialApproximation: IExponentialSmoothingParameters;
The InitialApproximation property determines initial approximation of parameters.
To determine the maximum number of iterations of the best trial method for searching parameters, use the IExponentialSmoothingBestTrialMethod.MaxIteration property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
Method: SmExponentialSmoothing;
serie: Array[15] Of Double;
status: Integer;
Seasonal: ISeasonal;
Auto: IExponentialSmoothingAutoSearch;
BTM: IExponentialSmoothingBestTrialMethod;
Begin
Method := New SmExponentialSmoothing.Create;
// Explanatory series:
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;
// Last forecast point:
Method.Forecast.LastPoint := 30;
// Seasonal component parameters:
Seasonal := Method.SeasonalComponent;
Seasonal.Mode := SeasonalityType.Additive;
Seasonal.Cycle := 4;
// Trend line type:
Method.TrendComponent := TrendType.Damped;
// Parameters autoselection settings:
Auto := Method.AutoSearch;
Auto.Criterion := CriterionType.MeanError;
Auto.Mode := SearchType.Optimal;
// Parameter autoselection settings for exponential smoothing
BTM := Auto.BestTrialMethod;
// Constant in the best trial method:
BTM.MethodConstant := 0.5;
// The number of implementations in one iteration of the best trial method:
BTM.Order := 7;
// The number of iterations of the best trial method:
BTM.MaxIteration := 10;
// Initial approximations of parameters:
BTM.InitialApproximation.Alpha := 0.03;
BTM.InitialApproximation.Delta := 0.03;
BTM.InitialApproximation.Gamma := 0.02;
BTM.InitialApproximation.Phi := 0.02;
// Model calculation and output of results:
status := Method.Execute;
If status <> 0 Then
Debug.WriteLine(Method.Errors);
Else
Debug.WriteLine("=== Parameters values ===");
Debug.WriteLine("Alpha " + Method.BestModelCoefficients.Alpha.ToString);
Debug.WriteLine("Delta " + Method.BestModelCoefficients.Delta.ToString);
Debug.WriteLine("Gamma " + Method.BestModelCoefficients.Gamma.ToString);
Debug.WriteLine("Phi " + Method.BestModelCoefficients.Phi.ToString);
End If;
End Sub UserProc;
After executing the example the console window displays parameters values.
See also: