StatCoefficients(Coord: IMsFormulaTransformCoord): IModelCoefficients;
Coord. Output variable slice, for which calculation is executed.
The StatCoefficients property returns values of summary statistics calculated for identified equation coefficients.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container contains a model with the BINREG identifier that uses the binary regression method for calculation.
Add links to the Metabase, Ms, Stat system assemblies.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Binary: IMsBinaryRegressionTransform;
Calc: IMsModelCalculation;
Coord: IMsFormulaTransformCoord;
Coef: IModelCoefficients;
Estim: Array Of Double;
i: Integer;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("BinReg",MB.ItemById("CONT_MODEL").Key).Edit;
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);
Binary := Formula.Method As IMsBinaryRegressionTransform;
// Determine confidence limits significance
Binary.ConfidenceLevel:= 0.9;
// Determine a missing data treatment method
Binary.MissingData.Method:= MissingDataMethod.SampleAverage;
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate:= DateTime.ComposeDay(2000, 01, 01);
Calc.Period.IdentificationEndDate:= DateTime.ComposeDay(2007, 12, 31);
Calc.Period.ForecastStartDate:= DateTime.ComposeDay(2007, 01, 01);
Calc.Period.ForecastEndDate:= DateTime.ComposeDay(2010, 12, 31);
Coord := Trans.CreateCoord(VarTrans);
// Identification of new equation
Binary.Identify(Calc As IMsMethodCalculation, Coord);
// Get summary statistics values
Coef := Binary.StatCoefficients(Coord);
// Array of estimated values of model coefficients
Estim := Coef.Coefficients.Estimate;
// Display array in the console
For i := 0 To Estim.Length - 1 Do
Debug.WriteLine(Estim[i]);
End For;
MObj.Save;
End Sub Main;
After executing the example some parameters of the model are changed. After equation identification the array of estimated model coefficients is displayed in the console window.
See also: