IMs2SLSTransform.PairCorrelationMatrix

Syntax

PairCorrelationMatrix(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): Array;

Parameters

Calculation. Settings that are necessary for model calculation.

Coord. Output variable slice, for which calculation is executed.

Description

The PairCorrelationMatrix property returns the real array containing a correlation matrix.

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 linear regression method (instrumental variables estimation) for calculation.

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;
    SLS2: IMs2SLSTransform;
    Calc: IMsModelCalculation;
    Coord: IMsFormulaTransformCoord;
    PairArr: Array Of Double;
    i, j: 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 := Model.Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Model.Transform.Transform(Selector);
    SLS2 := 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(20101231);
    Coord := Trans.CreateCoord(VarTrans);
    //identification of equation
    SLS2.Identify(Calc As IMsMethodCalculation, Coord);
    PairArr := SLS2.PairCorrelationMatrix(Calc As IMsMethodCalculation, Coord);
    For i := 0 To PairArr.GetUpperBound(1Do
        For j := 0 To PairArr.GetUpperBound(2Do
            Debug.Write(String.Format("{0,6:F}", PairArr[i, j]));
        End For;
        Debug.WriteLine("");
    End For;
    MObj.Save;
End Sub UserProc;

After executing the example the model equation coefficients are identified, and the console window displays correlation matrix.

See also:

IMs2SLSTransform