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 with the list from mathematical statistic (ISmCurveEstimation.DependenceForms).
Executing the example requires that the repository contains a modeling container that contains a model with the NEW_CURVESTMODEL identifier. The universal trend method is used for model calculation.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
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;
After executing the example the console displays dependency forms names and criterion values calculated for the forms selected in the model. The best dependency form index is also displayed.
See also: