Criterion: DependenceCriterion;
The Criterion property determines the criterion, based on which a model is selected.
Executing the example requires that the repository contains a modeling container with the KONT_MODEL identifier. The container contains the VAR_1 variable that will be used as an output one.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
Varr: IMsVariable;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
CurveEst: IMsCurveEstimationTransform;
Begin
MB := MetabaseClass.Active;
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_CurveEstimationModel";
CrInf.Name := "New_CurveEstimationModel";
CrInf.Parent := Mb.ItemById("KONT_MODEL");
CrInf.Permanent := False;
MObj := Mb.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
Varr := MB.ItemByIdNamespace("Var_1",MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Output.Add(Varr);
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);
Formula.Kind := MsFormulaKind.CurveEstimation;
CurveEst := Formula.Method As IMsCurveEstimationTransform;
CurveEst.CongidenceLevel := 0.99;
CurveEst.Criterion := DependenceCriterion.RSS;
CurveEst.DependenceFormIncluded(DependenceType.Compound):= True;
CurveEst.DependenceFormIncluded(DependenceType.Logarithmic):= True;
CurveEst.DependenceFormIncluded(DependenceType.Hyperbolic):= True;
MObj.Save;
End Sub;
After executing the example a model is created in the modeling container. The universal trend method is used for model calculation. As a result of method execution the composite, logarithmic and hyperbolic dependencies are calculated. The output model is selected by the least value of sum of squared residuals. The value 0.99 is set for a significance value of confidential limits.
See also: