InversionLag: MsInversionLag;
The InversionLag property determines the period, on which the initial transformation is executed.
The property is outdated, use InversionInfo.Inversionlag.
The property is relevant if any method except the natural logarithm, normalization, standardization is selected as the transformation method.
Executing the example requires that the repository contains a modeling container with the KONT_MODEL identifier. The container contains the Var_1 variable, further used as a output variable, and also the Var_Factor variable, used as a factor.
Sub Main;
Var
MB: IMetabase;
Kont: IMetabaseObjectDescriptor;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
NonLinear: IMsNonLinearRegressionTransform;
Varr: IVariableStub;
TransVar: IMsFormulaTransformVariable;
TermX1: IMsFormulaTerm;
TermX1Info: IMsFormulaTermInfo;
Begin
MB := MetabaseClass.Active;
Kont := Mb.ItemById("KONT_MODEL");
//create a model
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_NonLinReg";
CrInf.Name := "New_NonLinReg";
CrInf.Parent := Kont;
MObj := Mb.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
// add output variable
Varr := MB.ItemByIdNamespace("Var_1", Kont.Key).Bind As IVariableStub;
Trans.Outputs.Add(Varr);
VarTrans := Trans.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Trans.CreateSelector;
Selector.Slice := Slice;
Formula := Trans.Transform(Selector);
Formula.Kind := MsFormulaKind.NonLinearRegression;
Formula.Level := DimCalendarLevel.Year;
NonLinear := Formula.Method As IMsNonLinearRegressionTransform;
//adding a factor
Varr := MB.ItemByIdNamespace("Var_Factor", Kont.Key).Bind As IVariableStub;
Trans.Inputs.Add(Varr);
TransVar := Trans.Inputs.Item(0);
Slice := TransVar.SlicesTree(VarTrans).CreateSlice(1);
//comparison of term to the slice in the variable
TermX1 := NonLinear.Operands.Add(Slice);
TermX1Info := TermX1.TermInfo;
//changing parameters of the first term
TermX1Info.Inversion := MsInversion.DLog;
TermX1Info.InversionLag := MsInversionLag.PrecidingValue;
TermX1Info.PreviousInversionLag := -2;
TermX1.TermInfo := TermX1Info;
//creation of the equation
NonLinear.Expression.AsString := "A0+" + TermX1Info.TermInnerText + "/10";
MObj.Save;
End Sub Main;
After executing the example, a new model is created in the modeling container. The output variable and one input variable is added into the model. For making the equation the term, that refers to the slice of input variable, is created. The way of initial transformation of data and lag is changed for the term. The method of non-linear regression is used for model calculation.
See also: