IModelling.ExpSmooth

Fore Syntax

ExpSmooth(Input: ITimeSeries;
          Period: IMsPeriod;
          SeasonalEffect: SeasonalityType;
          SeasonalPeriod: Integer;
          Trend: TrendType;
          Alpha: Variant;
          Delta: Variant;
          Gamma: Variant;
          Phi: Variant;
          [Casewise: MsCasewise = 0;]
          [GridStep: Double = 0.1]): Variant;

Fore Syntax

ExpSmooth(Input: Prognoz.Platform.Interop.Ms.ITimeSeries;
          Period: Prognoz.Platform.Interop.Ms.IMsPeriod;

          SeasonalEffect: Prognoz.Platform.Interop.Stat.SeasonalityType;

          SeasonalPeriod: integer;

          Trend: Prognoz.Platform.Interop.Stat.TrendType;

          Alpha: object;

          Delta: object;

          Gamma: object;

          Phi: object;
          Casewise: Prognoz.Platform.Interop.Ms.MsCasewise;
          GridStep: double;
          Context: Prognoz.Platform.Interop.Fore.ForeRuntimeContext): object;

Parameters

Input. Variable.

Period. Period, at which the method is calculated. If the parameter is set to Null, the method is calculated at the entire time period.

SeasonalEffect. Seasonal model.

SeasonalPeriod. Length of seasonal period.

Trend. Growth model.

Alpha. Alpha coefficient.

Delta. Delta coefficient.

Gamma. Gamma coefficient.

Phi. Phi coefficient.

Casewise. Missing data treatment method.

GridStep. Grid step.

Context. Context. The parameter is used only in Fore.NET.

Description

The Expsmooth method transforms variable with the help of exponential smoothing.

Comments

The SeasonalPeriod parameter value must be greater or equal to four. The parameter is taken into account if the additive or multiplicative seasonal model is used.

Values of the Alpha, Delta, Gamma, Phi coefficients can be set by user or automatically. Use the IModelling.Estimate method to estimate values automatically.

The value of the Delta parameter is taken into account if the additive or multiplicative seasonal model is used.

The value of the Gamma parameter is taken into account if the additive or exponential growth model is used.

The value of the Phi parameter is taken into account if the fading growth model is used.

Casewise. Optional parameter. Missing data treatment is not used by default.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier. A model with the MODEL_D identifier calculated by the method of determinate equation and containing at least one factor must be available in this container.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    ModelSpace, ModelObj: IMetabaseObject;
    Transf: IMsFormulaTransform;
    Formula: IMsFormula;
    Model: IMsModel;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    TermInfo: IMsFormulaTermInfo;
    Expr: IExpression;
Begin
    Mb := MetabaseClass.Active;
    ModelSpace := Mb.ItemById("MS").Bind;
    ModelObj := Mb.ItemByIdNamespace("MODEL_D", ModelSpace.Key).Edit;
    Model := ModelObj As IMsModel;
    Transf := Model.Transform;
    Formula := Transf.FormulaItem(0);
    Determ := Formula.Method As IMsDeterministicTransform;
    TransVar := Transf.Inputs.Item(0);
    Slice := TransVar.Slices.Item(0);
    TermInfo := Transf.CreateTermInfo;
    TermInfo.Slice := Slice;
    TermInfo.Type := MsFormulaTermType.Pointwise;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "ExpSmooth(" + TermInfo.TermInnerText + ",SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "), SeasonalityType.Additive, 4, TrendType.Damped, " +
        "0.15, Estimate, Estimate, Estimate, MsCasewise.No, 0.2)";
    If Expr.Valid Then
        ModelObj.Save;
    Else
        Debug.WriteLine("Model is not saved: error in formula");
    End If;
End Sub UserProc;

After executing the example the model transforms the first input variable using the exponential smoothing method for the period from 2000 to 2015. Calculation is executed without missing data treatment.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub
 Main(Params: StartParams);
Var
    Mb: IMetabase;
    ModelSpace, ModelObj: IMetabaseObject;
    Transf: IMsFormulaTransform;
    Formula: IMsFormula;
    Model: IMsModel;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    TermInfo: IMsFormulaTermInfo;
    Expr: IExpression;
Begin
    Mb := Params.Metabase;
    ModelSpace := Mb.ItemById["MS"].Bind();
    ModelObj := Mb.ItemByIdNamespace["MODEL_D", ModelSpace.Key].Edit();
    Model := ModelObj As IMsModel;
    Transf := Model.Transform;
    Formula := Transf.FormulaItem[0];
    Determ := Formula.Method As IMsDeterministicTransform;
    TransVar := Transf.Inputs.Item[0];
    Slice := TransVar.Slices.Item[0];
    TermInfo := Transf.CreateTermInfo();
    TermInfo.Slice := Slice;
    TermInfo.Type := MsFormulaTermType.mfttPointwise;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "ExpSmooth(" + TermInfo.TermInnerText + ",SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "), SeasonalityType.Additive, 4, TrendType.Damped, " +
        "0.15, Estimate, Estimate, Estimate, MsCasewise.No, 0.2)";
    If Expr.Valid Then
        ModelObj.Save();
    Else
        System.Diagnostics.Debug.WriteLine("Model is not saved: error in the formula");
    End If;
End Sub;

Example of Use in Expressions

Expression 1:

ExpSmooth({Brazil|BCA[t]}, SetPeriod("01.01.2005", "01.01.2015"), SeasonalityType.Additive, 4, TrendType.Linear, 0.1, 0, 0.1, 0, MsCasewise.No, 0.2)

Result: for the Brazil|BCA series the exponential smoothing is executed by the following parameters: the additive seasonal model is used, the length of seasonal period is 4, value of the coefficients Delta and Phi are 0, Alfa and Gamma are 0.1, calculation is executed without missing data treatment, calculation period is from 2005 to 2015, grid step is 0.2

Use: it can be used in formulas of calculated series of time series database and in formulas of attribute-based models of modeling container.

Expression 2:

ExpSmooth(X1, Null, SeasonalityType.Additive, 4, TrendType.Linear, 0.2, 0, 0.2, 0, MsCasewise.No, 0.3)

Result: for the X1 factor the exponential smoothing is executed for the entire period by the following parameters: the additive seasonal model is used, the length of seasonal period is 4, the values of the coefficients Delta and Phi are 0, Alfa and Gamma are 0.2, grid step is 0.3.

Use: it can be used in model variable-based formulas of modeling container.

See also:

IModelling | The  Exponential Smoothing  Method | Time Series Database: Calculator, Exponential Smoothing  | Modeling Container: The Exponential Smoothing, Editing Regressor or Formula