IModelling.ExpSmooth

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;

Parameters

Input. Variable.

Period. Period, at which the method is calculated.

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.

Description

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

Comments

Features of setting parameters:

NOTE. Values of the Alpha, Delta, Gamma, Phi coefficients can be set by the user or estimated automatically. To estimate values automatically, use the IModelling.Estimate method.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D identifier that is calculated by the determinate equation method and contains at least one factor.

Add links to the Metabase and 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 at the period from 2000 to 2015. Calculation is executed without missing data treatment.

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 cross functional expression editor in any platform tool where it is available.

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 formulas of modeling container based on variables.

See also:

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