IMs2SLSTransform.Coefficients

Syntax

Coefficients(Coord: IMsFormulaTransformCoord): Array;

Parameters

Coord. The output variable dimension, for which calculation is executed.

Description

The Coefficients property determines an array of values of model equation coefficients. If a constant is present in the equation, its value is specified in the last element of the array. To save the coefficients, assign an array of values to this property; to flush the coefficients, assign the Null value.

Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. A model with the New_2SLS identifier created in this container uses the method of linear regression for calculation (instrumental variables estimation).

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Model: IMsModel;
    Trans: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    SLS: IMs2SLSTransform;
    Calc: IMsModelCalculation;
    Coord: IMsFormulaTransformCoord;
    Coef: Array Of Double;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("New_2SLS", MB.ItemById("MODEL_SPACE").Key).Edit;
    Model := MObj As IMsModel;
    Trans := Model.Transform;
    VarTrans := Trans.Outputs.Item(0);
    Tree := VarTrans.SlicesTree(VarTrans);
    Slice := Tree.CreateSlice(1);
    Selector := Trans.CreateSelector;
    Selector.Slice := Slice;
    Formula := Trans.Transform(Selector);
    SLS := Formula.Method As IMs2SLSTransform;
    Calc := Model.CreateCalculation;
    Calc.Period.IdentificationStartDate := DateTime.ComposeDay(19900101);
    Calc.Period.IdentificationEndDate := DateTime.ComposeDay(20001231);
    Calc.Period.ForecastStartDate := DateTime.ComposeDay(20010101);
    Calc.Period.ForecastEndDate := DateTime.ComposeDay(20100101);
    Coord := Trans.CreateCoord(VarTrans);
    //Identification of new equation
    SLS.Identify(Calc As IMsMethodCalculation, Coord);
    //Receive the calculated coefficients
    Coef := SLS.Coefficients(Coord);
    //If is not saved - save
    If Not SLS.IsCoefficientsSaved(Coord) Then
        SLS.Coefficients(Coord) := Coef;
    End If;
    //Display to console
    For i := 0 To Coef.Length - 1 Do
        Debug.WriteLine(Coef[i]);
    End For;
    MObj.Save;
End Sub UserProc;

After executing the example new coefficients of equation are calculated. The coefficient values are saved and displayed in the development environment console window.

See also:

IMs2SLSTransform