PairCorrelationMatrix(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): Array;
Calculation. Model calculation options.
Coord. The model slice, by which calculation is executed.
The PairCorrelationMatrix property returns the matrix of model factor correlation.
The Calculation and Coord parameters cannot take the Null value.
The array that contains the factors values is returned by the IMsDeterministicTransform.FactsMatrix property.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a 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(1) To matrix.GetUpperBound(1) Do
Debug.Write(matrix[j, i]);
End For;
Debug.Unindent;
Debug.WriteLine("");
End For;
End Sub UserProc;
After executing the example the console window displays the correlation matrix of determinate equation model factors.
See also: