IMsExponentialSmoothingTransform.BestModelCoefficients

Syntax

BestModelCoefficients: IExponentialSmoothingParameters;

Description

The BestModelCoefficients property returns autoselection results of exponential smoothing parameters.

Comments

Results are available only after method calculation.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a model with the MODEL_EXPLSM identifier. This model should be calculated using the Exponential Smoothing method.

Add links to the Metabase, Ms, Stat system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    msKey: Integer;
    model: IMsModel;
    method: IMsMethod;
    exp: IMsExponentialSmoothingTransform;
    transf: IMsFormulaTransform;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsMethodCalculation;
    res: IMsModelCalculationResult;
    autoSearch: IExponentialSmoothingAutoSearch;
    coef: IExponentialSmoothingParameters;
    i: Integer;
    explSerie: Array Of Double;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get modeling container key
    msKey := mb.GetObjectKeyById("MS");
    // Get model
    model := mb.ItemByIdNamespace("MODEL_EXPLSM", msKey).Bind As IMsModel;
    // Get the parameters of the method of model calculation
    transf := model.Transform;
    method := transf.FormulaItem(0).Method;
    exp := method As IMsExponentialSmoothingTransform;
    coord := transf.CreateCoord(transf.Outputs.Item(0));
    // Create object for method calculation
    calc := transf.CreateCalculation;
    calc.Period.IdentificationStartDate := transf.Period.IdentificationStartDate;
    calc.Period.IdentificationEndDate := transf.Period.IdentificationEndDate;
    calc.Period.ForecastStartDate := transf.Period.ForecastStartDate;
    calc.Period.ForecastEndDate := transf.Period.ForecastEndDate;
    calc.CurrentPoint := transf.Period.IdentificationStartDate;
    // Perform calculation
    res := exp.Execute(calc, Coord);
    // Show results in console window
    If res.StatMethod.Status = 0 Then
        autoSearch := exp.AutoSearch;
        coef := exp.BestModelCoefficients;
        Debug.WriteLine("Parameter values:");
        Debug.Indent;
        Debug.Write("Alpha = " + coef.Alpha.ToString);
        PrintInfo(autoSearch.AlphaSearch);
        Debug.Write("Delta = " + coef.Delta.ToString);
        PrintInfo(autoSearch.DeltaSearch);
        Debug.Write("Gamma = " + coef.Gamma.ToString);
        PrintInfo(autoSearch.GammaSearch);
        Debug.Write("Phi = " + coef.Phi.ToString);
        PrintInfo(autoSearch.PhiSearch);
        Debug.Unindent;
    End If;
    explSerie := exp.Explained.Serie(calc);
    Debug.WriteLine("Modeling series values:");
    Debug.Indent;
    For i := 0 To explSerie.Length - 1 Do
        Debug.WriteLine(explSerie[i]);
    End For;
    Debug.Unindent;
End Sub UserProc;

Sub PrintInfo(AutoParam: Boolean);
Begin
    If AutoParam Then
        Debug.WriteLine(" (calculated automatically)");
    Else
        Debug.WriteLine(" (set by user)");
    End If;
End Sub PrintInfo;

After executing the example the console window displays parameter values and model modelling series values.

See also:

IMsExponentialSmoothingTransform