Item(Index: Integer): Integer;
Index. Index of additional dimension in the variable.
The Item property determines the index of the additional dimension of the variable, by which the calculation is performed.
Executing the example requires that the modeling container includes the model, that uses the method of linear regression for calculation. The output variable contains one additional dimension.
Sub Main;
Var
MB: IMetabase;
Model: IMsModel;
Transform: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
LinReg: IMsLinearRegressionTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
i: Integer;
Begin
MB := MetabaseClass.Active;
Model := MB.ItemByIdNamespace("Model_1", MB.ItemById("KONT_MODEL").Key).Bind As IMsModel;
Transform := Model.Transform;
VarTrans := Transform.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Output.Item(0).Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
LinReg := Formula.Method As IMsLinearRegressionTransform;
Coord := Model.Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2007, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2008, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
For i := 0 To Coord.Dimension(0).Elements.Count - 1 Do
Coord.Item(0) := i;
LinReg.Identify(Calc As IMsMethodCalculation, Coord);
Debug.WriteLine(LinReg.Summary(Coord).R2.ToString);
End For;
End Sub Main;
After executing the example, the console window displays value of determination factor, calculated during identification of factors of the model equation. Calculation is executed by all elements of additional dimension of the output variable.
See also: