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 MODEL_SPACE identifier. A model with the New_2SLS identifier created in this container uses the method of linear regression for calculation (instrumental variables estimation).
Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
SLS2: IMs2SLSTransform;
Calc: IMsModelCalculation;
Period: IMsModelPeriod;
Coord: IMsFormulaTransformCoord;
Coef: ICoefficients;
a: Array Of Double;
i: Integer;
Begin
MB := MetabaseClass.Active;
Model := MB.ItemByIdNamespace("New_2SLS", MB.ItemById("MODEL_SPACE").Key).Bind As IMsModel;
Trans := Model.Transform;
VarTrans := Trans.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Trans.CreateSelector;
Selector.Slice := Slice;
Formula := Trans.Transform(Selector);
SLS2 := Formula.Method As IMs2SLSTransform;
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);
SLS2.Identify(Calc As IMsMethodCalculation, Coord);
Coef := SLS2.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. Summary statistics values, calculated for the coefficients, are displayed in the console window.
See also: