IModelling.Ecm

Syntax

Ecm(Input: ITimeSeries;

    Period: IMsPeriod

    Method: ECMType;

    EndogenousVariableAROrder: Integer;

    ExogenousVariableAROrder: Integer;

    Casewise: MsCasewise;

    Explanatories: Array): Variant;

Parameters

Input. Output variable.

Period. Period, at which the method is calculated

Method. Type of error correction model.

EndogenousVariableAROrder. Autoregression order of endogenous (output) variable.

ExogenousVariableAROrder. Autoregression order of exogenous variables.

Casewise. Missing data treatment method.

Explanatories. Exogenous (explanatory) variables.

Description

The Ecm method transforms variable by  error correction model.

Comments

Features of setting parameters:

Use this method only when series calculation mode is applied.

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 several factors.

Add links to the Metabase and Ms system assemblies.

Sub ProcEcm;
Var
    Mb: IMetabase;
    ModelSpace, ModelObj: IMetabaseObject;
    Transf: IMsFormulaTransform;
    Formula: IMsFormula;
    Model: IMsModel;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    TermInfo: IMsFormulaTermInfo;
    Inp_1, Inp_2: String;
    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;
    Inp_1 := TermInfo.TermInnerText;
    TransVar := Transf.Inputs.Item(1);
    Slice := TransVar.Slices.Item(0);
    TermInfo := Transf.CreateTermInfo;
    TermInfo.Slice := Slice;
    TermInfo.Type := MsFormulaTermType.Pointwise;
    Inp_2 := TermInfo.TermInnerText;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "Ecm(" + Inp_1 + ",SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "), ECMType.NoTrendNoIntercept, 1, 0, MsCasewise.Yes, "
 + Inp_2 + ")";
    If Expr.Valid
        Then ModelObj.Save;
        Else Debug.WriteLine(Model is not saved: error in formula);
    End If;
End Sub ProcEcm;

After executing the example the model will transform the first input variable using the error correction model. The calculation is applied at the period of 2000-2015 by missing data treatment by the Casewise method.

Example of Use in Expressions

Expression 1:

Ecm({Brazil|BCA[t]},SetPeriod("01.01.2002","01.01.2016"),ECMType.NoTrendIntercept,1,0, MsCasewise.Yes,{Afghanistan|BCA},{Canada|BCA})

Result: the error correction model is calculated by the following parameters for the Brazil|BCA series: model without trend in autoregression and with constant in cointegration level, the autoregression order in endogenous variable is 1, the order of autoregression of exogenous variables is 0, exogenous (explanatory) variables are Afghanistan|BCA and Canada|BCA factors. The calculation is executed at the period of 2002-2016 by the Casewise missing data treatment method.

Use: it can be used in formulas of cross functional expression editor in any platform tool where it is available.

Expression 2:

Ecm(X1,ECMType.TrendIntercept,0,1, MsCasewise.Yes,X2,X3)

Result: the error correction model is calculated by the following parameters for the X1 factor: model with linear trend in autoregression and constant in cointegration equation, the order of autoregression of endogenous variable is 0, order of autoregression of exogenous variables is 1, exogenous (explanatory) variables are the X2 and the X3 factors. Calculation is executed for the whole period using the Casewise missing data treatment method.

Use: it can be used in model formulas of modeling container based on variables.

See also:

Imodelling | Method of Calculation of  error correction model | Time Series Database: Calculator, Error Correction Model | Modeling Container:Error Correction Model, Editing Regressor or Formula