Explained: IEmSerie;
Explained: Prognoz.Platform.Interop.Modeller.IEmSerie;
The Explained property determines a smoothable series.
If the smoothable series is not specified, the Exponential Smoothing method calculation is not possible.
To execute the example, add links to the Modeller, Stat system assemblies.
Sub ExponentialSmoothing;
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmExponentialSmoothingSettings;
Period: IEmPeriodSettings;
Begin
ExprMod := New ExpressModeller.Create;
Sett := ExprMod.CreateExponentialSmoothingSettings;
// Setting smoothable series
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett.Explained := Serie;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.Additive;
// Setting seasonality period
Sett.SeasonalityCycle := 4;
// Setting trend type
Sett.Trend := TrendType.Linear;
// Setting smoothing coefficients
Sett.Alpha := 0.2;
Sett.Delta := 0.5;
Sett.Gamma := 0.7;
//Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 0;
Period.EndPeriod := 13;
Period.EndFore := 4;
// Performing the linear trend calculation
ExprMod.EvaluateMethod("C:\ExponentialSmoothing_Linear.html", Sett, True);
// Setting trend type
Sett.Trend := TrendType.Damped;
// Setting smoothing coefficients
Sett.Alpha := 0.4;
Sett.Gamma := 0.6;
Sett.Phi := 0.4;
// Performing the damped trend calculation
ExprMod.EvaluateMethod("C:\ExponentialSmoothing_Damped.html", Sett, True);
End Sub ExponentialSmoothing;
Example execution result: the Exponential Smoothing method is calculated with set parameters for two trend models. Calculation report for the linear trend is saved to the file C:ExponentialSmoothing_Linear.html; for the damped trend to the C:ExponentialSmoothing_Damped.html file.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub ExponentialSmoothing();
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmExponentialSmoothingSettings;
Period: IEmPeriodSettings;
Begin
ExprMod := New ExpressModeller.Create();
Sett := ExprMod.CreateExponentialSmoothingSettings();
// Setting smoothable series
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett.Explained := Serie;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.sstAdditive;
// Setting seasonality period
Sett.SeasonalityCycle := 4;
// Setting trend type
Sett.Trend := TrendType.tdtLinear;
// Setting smoothing coefficients
Sett.Alpha := 0.2;
Sett.Delta := 0.5;
Sett.Gamma := 0.7;
//Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 0;
Period.EndPeriod := 13;
Period.EndFore := 4;
// Performing the linear trend calculation
ExprMod.EvaluateMethod("C:\ExponentialSmoothing_Linear.html", Sett, True);
// Setting trend type
Sett.Trend := TrendType.tdtDamped;
// Setting smoothing coefficients
Sett.Alpha := 0.4;
Sett.Gamma := 0.6;
Sett.Phi := 0.4;
// Performing the damped trend calculation
ExprMod.EvaluateMethod("C:\ExponentialSmoothing_Damped.html", Sett, True);
End Sub ExponentialSmoothing;
Example execution result: the Exponential Smoothing method is calculated with set parameters for two trend models. Calculation report for the linear trend is saved to the file C:ExponentialSmoothing_Linear.html; for the damped trend to the C:ExponentialSmoothing_Damped.html file.
See also: