StatCoefficients(Coord: IMsFormulaTransformCoord): IModelCoefficients;
Coord. Output variable slice for which the calculation is performed.
The StatCoefficients property returns values of summary statistics calculated for identified equation coefficients.
Executing the example requires that the modeling container includes a model that uses the linear regression (OLS estimation) method for calculation.
Sub Main;
Var
MB: IMetabase;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Linear: IMsLinearRegressionTransform;
Calc: IMsModelCalculation;
Period: IMsModelPeriod;
Coord: IMsFormulaTransformCoord;
Coef: ICoefficients;
a: Array Of Double;
i: Integer;
Begin
MB := MetabaseClass.Active;
Model := MB.ItemByIdNamespace("New_LinReg", MB.ItemById("KONT_MODEL").Key).Bind 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);
Linear := Formula.Method As IMsLinearRegressionTransform;
Calc := Model.CreateCalculation;
Period := Calc.Period;
Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);
Period.IdentificationEndDate := DateTime.ComposeDay(2000, 12, 31);
Period.ForecastStartDate := DateTime.ComposeDay(2001, 01, 01);
Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
Coord := Trans.CreateCoord(VarTrans);
Linear.Identify(Calc As IMsMethodCalculation, Coord);
Coef := Linear.StatCoefficients(Coord).Coefficients;
Debug.WriteLine("Values");
a := Coef.Estimate;
For i := 0 To a.Length - 1 Do
Debug.WriteLine(a[i]);
End For;
Debug.WriteLine("Probability");
a := Coef.Probability;
For i := 0 To a.Length - 1 Do
Debug.WriteLine(a[i]);
End For;
Debug.WriteLine("Standard error");
a := Coef.StandardError;
For i := 0 To a.Length - 1 Do
Debug.WriteLine(a[i]);
End For;
Debug.WriteLine("t-statistic value");
a := Coef.TStatistic;
For i := 0 To a.Length - 1 Do
Debug.WriteLine(a[i]);
End For;
End Sub Main;
After executing the example the model equation coefficients are identified. Summary statistics values, calculated for the coefficients, are displayed in the console window.
See also: