Show contents 

Ms > Ms Assembly Interfaces > IMsNonLinearRegressionTransform > IMsNonLinearRegressionTransform.Operands

IMsNonLinearRegressionTransform.Operands

Syntax

Operands: IMsFormulaTermList;

Description

The Operands property returns the collection of terms used to compile the model equation.

Example

Sub UserProc;
Var
    MB: IMetabase;
    CrInf: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Model: IMsModel;
    Trans: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    NonLinear: IMsNonLinearRegressionTransform;
    Varr: IMsVariableStub;
    TransVar: IMsFormulaTransformVariable;
    TermX1: IMsFormulaTerm;
    s: String;
Begin
    MB := MetabaseClass.Active;
    //create a model
    CrInf := Mb.CreateCreateInfo;
    CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
    CrInf.Id := "New_NonLinReg";
    CrInf.Name := "New_NonLinReg";
    CrInf.Parent := Mb.ItemById("KONT_MODEL");
    CrInf.Permanent := False;
    MObj := Mb.CreateObject(CrInf).Edit;
    Model := MObj As IMsModel;
    Trans := Model.Transform;
    //add an output variable
    Varr := MB.ItemByIdNamespace("Var_1", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariableStub;
    Trans.Outputs.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.NonLinearRegression;
    NonLinear := Formula.Method As IMsNonLinearRegressionTransform;
    //add a factor
    Varr := MB.ItemByIdNamespace("VAR_FACTOR", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariableStub;
    Trans.Inputs.Add(Varr);
    TransVar := Model.Transform.Inputs.Item(0);
    //compare the term to the slice in variable
    TermX1 := NonLinear.Operands.Add(TransVar.SlicesTree(VarTrans).CreateSlice(1));
    //create an equation
    s := "A0+" + TermX1.TermToInnerText + "/10 " + "/A1";
    NonLinear.Expression.AsString := s;
    MObj.Save;
End Sub UserProc;

After executing the example, a new model is created in the modeling container. The method of non-linear regression is used for model calculation. An output variable and one input variable are added to the created model. To compose the equation the term that refers to the input variable slice is created.

See also:

IMsNonLinearRegressionTransform