ChangeLag(Value: Integer);
Value. The value, to which the current lag value must be changed.
The ChangeLag method changes lag value.
Executing the example requires that the repository contains a modeling container containing a model with the NEW_LINREG identifier. The linear regression method is used for model calculation.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
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;
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: