ChangeLag (Value: Integer);
Value. The value, to which the current lag value must be changed.
The ChangeLag method changes the lag value to the value that is passed by the Value parameter.
Executing the example requires a modeling container of model with the NEW_LINREG identifier. The linear regression method is used for model calculation.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
LinReg: IMsLinearRegressionTransform;
TransVar: IMsFormulaTransformVariable;
ComposForm: IMsCompositeFormulaTermList;
ComposTerm: IMsCompositeFormulaTerm;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("New_LinReg", MB.ItemById("KONT_MODEL").Key).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
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;
TransVar := Model.Transform.Inputs.Item(0);
ComposForm := LinReg.Explanatories;
ComposTerm := ComposForm.Item(0);
ComposTerm.Inversion := MsInversion.Normalization;
ComposTerm.InversionLag := MsInversionLag.PrecidingValue;
ComposTerm.ChangeLag(-5);
MObj.Save;
End Sub Main;
After executing the example lag and initial transformation parameters are changed for the first composite term of the model. The lag value is increased by 5.
See also: