Ms > Ms Assembly Interfaces > IMsLinearRegressionTransform > IMsLinearRegressionTransform.StatCoefficients
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 the model that uses the method of linear regression for calculation.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Linear: IMsLinearRegressionTransform;
Calc: IMsModelCalculation;
Coord: IMsFormulaTransformCoord;
PairArr: Array Of Double;
i, j: Integer;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("NEW_LINREG", MB.ItemById("KONT_MODEL").Key).Bind;
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);
Linear := Formula.Method As IMsLinearRegressionTransform;
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2000, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2001, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
Coord := Trans.CreateCoord(VarTrans);
//identification of equation
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 UserProc;
After executing the example the model equation coefficients are identified. The console window displays summary statistics values calculated for the coefficients.
See also: