BestDependenceForm: Integer;
The BestDependenceForm property returns index of the best dependency form. The model with the least value of the criterion has the best dependency form. Model index corresponds to the list from the mathematical statistic (ISmCurveEstimation.DependenceForms).
Executing the example requires a model with the New_CurvEstModel identifier in the modeling container. The universal trend method is used for model calculation.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
CurveEst: IMsCurveEstimationTransform;
Coord: IMsFormulaTransformCoord;
StatCurve: ISmCurveEstimation;
DepForm: IDependenceForm;
i: Integer;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("New_CurvEstModel", MB.ItemById("KONT_MODEL").Key).Bind;
Model := MObj As IMsModel;
Trans := Model.Transform;
VarTrans := Trans.Outputs.Item(0);
Coord := Model.Transform.CreateCoord(VarTrans);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
CurveEst := Formula.Method As IMsCurveEstimationTransform;
StatCurve := CurveEst.StatMethod(Coord) As ISmCurveEstimation;
For i := 0 To StatCurve.DependenceForms.Count - 1 Do
DepForm := StatCurve.DependenceForms.Item(i);
Debug.WriteLine(DepForm.Name + " " + DepForm.CriterionValue.ToString);
End For;
Debug.WriteLine("Best form index: " + CurveEst.BestDependenceForm.ToString);
End Sub Main;
After executing the example dependency forms names and criterion values calculated for the forms selected in the model are displayed in the console. The best dependency form index is also displayed.
See also: