IMsDeterministicTransform.PairCorrelationMatrix

Fore Syntax

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

Fore.NET Syntax

PairCorrelationMatrix[Prognoz.Platform.Interop.Ms.IMsMethodCalculation,
Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord]: System.Array;

Parameters

Calculation. Model calculation parameters.

Coord. The model slice, by which calculation is executed.

Description

The property is read-only.

The PairCorrelationMatrix property returns the matrix of model factor correlation.

Comments

The Calculation and Coord parameters cannot be set to Null.

The array that contains the factors values is returned by the IMsDeterministicTransform.FactsMatrix property.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier that contains the determinate equation model with the ModelDeterm identifier. Add links to the Matrix, Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    hModel: IMetabaseObjectDescriptor;
    oModel: IMsModel;
    trans: IMsFormulaTransform;
    selector: IMsFormulaTransformSelector;
    formula: IMsFormula;
    output: IMsFormulaTransformVariable;
    determ: IMsDeterministicTransform;
    coord: IMsFormulaTransformCoord;
    calculation: IMsMethodCalculation;
    calcPeriod, modPeriod: IMsModelPeriod;
    matrix: Array Of Double;
    i, j: Integer;
    nCount: Integer;
    term: IMsFormulaTerm;
Begin
    mb := metabaseClass.Active;
    MsKey : = mb.ItemById("MS").Key;
    hModel := mb.ItemByIdNamespace("MODEL_DETERM", MsKey);
    oModel := hModel.Bind As IMsModel;
    trans := oModel.Transform;
    output := trans.Outputs.Item(0);
    selector := trans.CreateSelector;
    selector.Slice := output.Slices.Item(0);
    formula := trans.Transform(selector);
    determ := formula.Method As IMsDeterministicTransform;
    coord := trans.CreateCoord(output);
    calculation := trans.CreateCalculation;
    calcPeriod := calculation.Period;
    modPeriod := oModel.Period;
    calcPeriod.ForecastEndDate := modPeriod.ForecastEndDate;
    calcPeriod.ForecastStartDate := modPeriod.ForecastStartDate;
    calcPeriod.IdentificationEndDate := modPeriod.IdentificationEndDate;
    calcPeriod.IdentificationStartDate := modPeriod.IdentificationStartDate;
    matrix := determ.PairCorrelationMatrix(calculation, coord);
    nCount := determ.Operands.Count;
    Debug.IndentSize := 15;
    Debug.Indent;
    For i := 0 To nCount - 1 Do
        If i = 0 Then
            term := determ.Result;
        Else
            term := determ.Operands.Item(i - 1);
        End If;
        Debug.Write(term.TermToText);
    End For;
    Debug.WriteLine("");
    Debug.Unindent;
    Debug.IndentSize := 5;
    For i := 0 To nCount - 1 Do
        If i = 0 Then
            term := determ.Result;
        Else
            term := determ.Operands.Item(i - 1);
        End If;
        Debug.Write(term.TermToText);
        Debug.Indent;
        For j := matrix.GetLowerBound(1To matrix.GetUpperBound(1Do
            Debug.Write(matrix[j, i]);
        End For;
        Debug.Unindent;
        Debug.WriteLine("");
    End For;
End Sub UserProc;

After executing the example the correlation matrix of determinate equation model factors is displayed in the console window.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Matrix;

Private Sub UserProc;
Var
    mb: IMetabase;
    MsKey: uinteger;
    hModel: IMetabaseObjectDescriptor;
    oModel: IMsModel;
    trans: IMsFormulaTransform;
    selector: IMsFormulaTransformSelector;
    formula: IMsFormula;
    output: IMsFormulaTransformVariable;
    determ: IMsDeterministicTransform;
    coord: IMsFormulaTransformCoord;
    calculation: IMsMethodCalculation;
    calcPeriod, modPeriod: IMsModelPeriod;
    matrix: System.Array;
    i, j, k: Integer;
    nCount: Integer;
    term: IMsFormulaTerm;
Begin
    mb := Self.Metabase;
    MsKey := mb.ItemById["MS"].Key;
    hModel := mb.ItemByIdNamespace["MODEL_DETERM", MsKey];
    oModel := hModel.Bind() As IMsModel;
    trans := oModel.Transform;
    output := trans.Outputs.Item[0];
    selector := trans.CreateSelector();
    selector.Slice := output.Slices.Item[0];
    formula := trans.Transform[selector];
    determ := formula.Method As IMsDeterministicTransform;
    coord := trans.CreateCoord(output);
    calculation := trans.CreateCalculation();
    calcPeriod := calculation.Period;
    modPeriod := oModel.Period;
    calcPeriod.ForecastEndDate := modPeriod.ForecastEndDate;
    calcPeriod.ForecastStartDate := modPeriod.ForecastStartDate;
    calcPeriod.IdentificationEndDate := modPeriod.IdentificationEndDate;
    calcPeriod.IdentificationStartDate := modPeriod.IdentificationStartDate;
    matrix := determ.PairCorrelationMatrix[calculation, coord];
    nCount := determ.Operands.Count;
    System.Diagnostics.Debug.IndentSize := 15;
    System.Diagnostics.Debug.Indent();
    For i := 0 To nCount - 1 Do
        If i = 0 Then
            term := determ.Result;
        Else
            term := determ.Operands.Item[i - 1];
        End If;
        System.Diagnostics.Debug.Write(term.TermToText());
    End For;
    System.Diagnostics.Debug.WriteLine("");
    System.Diagnostics.Debug.Unindent();
    System.Diagnostics.Debug.IndentSize := 5;
    For i := 0 To nCount - 1 Do
        If i = 0 Then
            term := determ.Result;
        Else
            term := determ.Operands.Item[i - 1];
        End If;
        System.Diagnostics.Debug.Write(term.TermToText());
        System.Diagnostics.Debug.Indent();
        For j := matrix.GetLowerBound(1To matrix.GetUpperBound(1Do
            System.Diagnostics.Debug.Write(matrix[i, j]);
        End For;
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.WriteLine("");
    End For;
End Sub;

See also:

IMsDeterministicTransform