IMsCompositeFormulaTerm.InversionLag

Syntax

InversionLag: MsInversionLag;

Description

The InversionLag property determines the period, on which the initial transformation is executed.

Comments

This property is outdated, use InversionInfo.InversionLag instead.

It is relevant, if as a way of transformation, any method is chosen, except for the natural logarithm.

Example

Sub Main;

Var

MB: IMetabase;

CrInf: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Model: IMsModel;

Trans: IMsFormulaTransform;

VarTrans: IMsFormulaTransformVariable;

Tree: IMsFormulaTransformSlicesTree;

Slice: IMsFormulaTransformSlice;

Selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

LinReg: IMsLinearRegressionTransform;

Varr: IMsVariable;

TransVar: IMsFormulaTransformVariable;

ComposForm: IMsCompositeFormulaTermList;

ComposTerm: IMsCompositeFormulaTerm;

TermX1, TermX2: IMsFormulaTerm;

Begin

MB := MetabaseClass.Active;

//create a model

CrInf := Mb.CreateCreateInfo;

CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;

CrInf.Id := "New_LinReg";

CrInf.Name := "New_LinReg";

CrInf.Parent := Mb.ItemById("KONT_MODEL");

CrInf.Permanent := False;

MObj := Mb.CreateObject(CrInf).Edit;

Model := MObj As IMsModel;

Trans := Model.Transform;

// add output variable

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.LinearRegression;

LinReg := Formula.Method As IMsLinearRegressionTransform;

//adding a factor

Varr := MB.ItemByIdNamespace("Var_Factor", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;

Model.Input.Add(Varr);

TransVar := Model.Transform.Inputs.Item(0);

ComposForm := LinReg.Explanatories;

ComposTerm := ComposForm.Add;

Slice := TransVar.SlicesTree(Null).CreateSlice(1);

TermX1 := ComposTerm.Operands.Add(Slice);

Slice := TransVar.SlicesTree(Null).CreateSlice(2);

TermX2 := ComposTerm.Operands.Add(Slice);

ComposTerm.Expression.AsString := Trans.SliceToTerm(TermX1.Slice, TermX1.Lag.AsString) + "/" + Trans.SliceToTerm(TermX2.Slice, TermX2.Lag.AsString);

ComposTerm.Inversion := MsInversion.Normalization;

ComposTerm.InversionLag := MsInversionLag.PrecidingValue;

MObj.Save;

End Sub Main;

After executing the example, a new model is created in the modeling container. The output variable and one factor are added to the created model. For the equation of model the compound term that contains two terms, referring to slices of the first input variable is created. The way of initial transformation of data and lag is changed for the term. The method of linear regression is used for model calculation.

See also:

IMsCompositeFormulaTerm