MaxIteration: Integer;
The MaxIteration property determines the maximum number of iterations, within which the optimum solution is found.
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 an output one.
Sub Main;
Var
MB: IMetabase;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
Varr: IMsVariable;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
ARIMA: IMsArimaTransform;
ARIMASpec: IArimaSpecification;
Begin
MB := MetabaseClass.Active;
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_ARIMA";
CrInf.Name := "New_ARIMA";
CrInf.Parent := Mb.ItemById("KONT_MODEL");
CrInf.Permanent := False;
MObj := Mb.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
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.Arima;
Formula.Level := DimCalendarLevel.Quarter;
ARIMA := Formula.Method As IMsArimaTransform;
ARIMA.MaxIteration := 100;
ARIMA.ConstantMode := InterceptMode.ManualEstimate;
ARIMA.ConstantValue := 0.03;
ARIMASpec := ARIMA.ArimaSpecification;
//nonseasonal component
ARIMASpec.AutoRegressionOrder := 1;
ARIMASpec.MovingAverageOrder := 1;
ARIMASpec.DifferenceOrder := 2;
//seasonal component
ARIMASpec.SeasonalAutoRegressionOrder := 1;
ARIMASpec.SeasonalMovingAverageOrder := 2;
ARIMASpec.SeasonalDifferenceOrder := 3;
ARIMASpec.Cycle := 2;
MObj.Save;
End Sub Main;
After executing the example the model that uses the ARIMA method for calculation is created in the modeling container. The output variable is added to the model and seasonal and non-seasonal parameters are set up. The constant value will be set as constant. The optimum solution is calculated in 100 iterations of model calculation.
See also: