Arima(Input: ITimeSeries;
Period: IMsPeriod;
NotSeasonalIAR: String;
NotSeasonalIMA: String;
NotSeasonalDIFF: Integer;
ConstantValue: Variant;
[SeasonalAR: String = "";]
[SeasonalMA: String = "";]
[SeasonalDiff: Integer = 1;]
[SeasonalPeriod: Integer = 0;]
[MaxIteration: Integer = 500;]
[Precision: Double = 0.0001;]
[Casewise: MsCasewise = 0]): Variant;
Arima(Input: Prognoz.Platform.Interop.Ms.ITimeSeries;
Period: Prognoz.Platform.Interop.Ms.IMsPeriod;
NotSeasonalIAR: integer;
NotSeasonalIMA: integer;
NotSeasonalDIFF: integer;
ConstantValue: object;
SeasonalAR: integer;
SeasonalMA: integer;
SeasonalDiff: integer;
SeasonalPeriod: integer;
MaxIteration: integer;
Precision: double;
Casewise: Prognoz.Platform.Interop.Ms.MsCasewise;
Context: Prognoz.Platform.Interop.Fore.ForeRuntimeContext): object;
Input. Output variable.
Period. Period, at which the method is calculated. If the parameter is set to Null, the method is calculated at the entire time period.
NotSeasonalIAR. Non-seasonal autoregression order.
NotSeasonalIMA. Non-seasonal moving average order.
NotSeasonalDIFF. Non-seasonal difference order.
ConstantValue. Constant used in calculations.
SeasonalAR. Seasonal regression order.
SeasonalMA. Seasonal moving average order.
SeasonalDiff. Seasonal difference order.
SeasonalPeriod. Duration of seasonal period.
MaxIteration. Maximum number of iterations, in which the optimal decision must be found.
Precision. Calculation accuracy.
Casewise. Missing data treatment method.
Context. Context. The parameter is used only in Fore.NET.
The Arima method models variable values by the ARIMA method.
ConstantValue. The constant value can be determined by the user or estimated automatically. Use the IModelling.Estimate method to estimate values automatically. If the model must be calculated without constant, use the IModelling.None method.
NotSeasonalIAR, NotSeasonalIMA, SeasonalAR, SeasonalMA. Parameters are set in the string view. Specify the numbers or ranges of autoregression or moving average orders separated by commas. The range of autoregression or moving average orders is specified via the sign -. For example: SeasonalAR = "1-3,5".
NotSeasonalIMA, SeasonalMA. If the order of the moving average (seasonal/non-seasonal) is set, the back-casting can be used on estimate of its coefficients. Back-casting parameters are set once in the NotSeasonalIMA parameter and used for all types of moving average. Back-casting is used by default. If back-casting must be disabled, the NotSeasonalIMA parameter must contain the "backcast.No" string. For example: NotSeasonalIMA = "1-4;backcast.No".
Executing the example requires that the repository contains a modeling container with the MS identifier. A model with the MODEL_D identifier calculated by the method of determinate equation and containing at least one factor must be available in this container.
Add links to the Metabase, Ms system assemblies.
Sub UserArima;
Var
Mb: IMetabase;
ModelSpace, ModelObj: IMetabaseObject;
Transf: IMsFormulaTransform;
Formula: IMsFormula;
Model: IMsModel;
Determ: IMsDeterministicTransform;
TransVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
TermInfo: IMsFormulaTermInfo;
Expr: IExpression;
Begin
// Get repository
Mb := MetabaseClass.Active;
// Get modeling container
ModelSpace := Mb.ItemById("MS").Bind;
// Get the model
ModelObj := Mb.ItemByIdNamespace("MODEL_D", ModelSpace.Key).Edit;
Model := ModelObj As IMsModel;
// Get model calculation parameters
Transf := Model.Transform;
Formula := Transf.FormulaItem(0);
Determ := Formula.Method As IMsDeterministicTransform;
// Get the first input variable
TransVar := Transf.Inputs.Item(0);
Slice := TransVar.Slices.Item(0);
TermInfo := Transf.CreateTermInfo;
TermInfo.Slice := Slice;
// Set mode of passing variable into calculation
TermInfo.Type := MsFormulaTermType.Pointwise;
// Get model calculation expression
Expr := Determ.Expression;
Expr.References := "Ms";
// Set model calculation expression
Expr.AsString := "Arima(" + TermInfo.TermInnerText + ", SetPeriod(" +
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
"), " + """" + "" + """" + "," + """" + "1" + """" + ", 0, Estimate," +
"""" + "1" + """," + """" + "1" + """" + ",0, 1, 600, 0.001, MsCasewise.Yes) ";
// Check if the expression is correct
If Expr.Valid
// If the expression is set correctly, save the model
Then ModelObj.Save;
// If the expression is incorrect, display a message to the console window
Else Debug.WriteLine("Model is not saved: error in the formula");
End If;
End Sub UserArima;
After executing the example the model is calculated the value of first input variable by ARIMA method. The following parameters will be defined for the method: calculation period, autoregression and moving average orders, the constant will be auto estimated, and the Casewise method will be used for missing data treatment.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
ModelSpace, ModelObj: IMetabaseObject;
Transf: IMsFormulaTransform;
Formula: IMsFormula;
Model: IMsModel;
Determ: IMsDeterministicTransform;
TransVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
TermInfo: IMsFormulaTermInfo;
Expr: IExpression;
Begin
// Get repository
Mb := Params.Metabase;
// Get modeling container
ModelSpace := Mb.ItemById["MS"].Bind();
// Get the model
ModelObj := Mb.ItemByIdNamespace["MODEL_D", ModelSpace.Key].Edit();
Model := ModelObj As IMsModel;
// Get model calculation parameters
Transf := Model.Transform;
Formula := Transf.FormulaItem[0];
Determ := Formula.Method As IMsDeterministicTransform;
// Get the first input variable
TransVar := Transf.Inputs.Item[0];
Slice := TransVar.Slices.Item[0];
TermInfo := Transf.CreateTermInfo();
TermInfo.Slice := Slice;
// Set mode of passing variable into calculation
TermInfo.Type := MsFormulaTermType.mfttPointwise;
// Get model calculation expression
Expr := Determ.Expression;
Expr.References := "Ms";
// Set model calculation expression
Expr.AsString := "Arima(" + TermInfo.TermInnerText + ", SetPeriod(" +
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
"), " + """" + "" + """" + "," + """" + "1" + """" + ", 0, Estimate," +
"""" + "1" + """," + """" + "1" + """" + ",0, 1, 600, 0.001, MsCasewise.Yes) ";
// Check if the expression is correct
If Expr.Valid
// If the expression is set correctly, save the model
Then ModelObj.Save();
// If the expression is incorrect, display a message to the console window
Else System.Diagnostics.Debug.WriteLine("Model is not saved: error in the formula");
End If;
End Sub;
Expression 1:
Arima({Brazil|BCA[t]}, SetPeriod("2001", "2016"), "1-3", "1,4;backcast.No", 0, Estimate)
Result: for the Brazil|BCA series the ARIMA method is calculated by the following parameters: order of non-seasonal autoregression is 1-3, order of non-seasonal moving average is 1.4, back-casting is not used to estimate seasonal average coefficients, non-seasonal difference order is 0, constant value is estimated automatically, using the IModelling.Estimate method. Calculation is made without missing data treatment for the period from 2001 to 2016.
Use: it can be used in formulas of calculated series of time series database and in formulas of attribute-based models of modeling container.
Expression 2:
Arima(X1,Null,"","",1,2.7,"","",1,0,500,0.0001, MsCasewise.Yes)
Result: for the X1 factor ARIMA method is calculated by the following parameters: orders of non-seasonal autoregression and non-seasonal moving average are not assigned, order of non-seasonal difference is 1, constant value is 2.7, calculation is executed for the whole period without considering missing values.
Use: it can be used in model variable-based formulas of modeling container.
See also:
IModelling | The ARIMA Method | Time Series Database: Calculator, ARIMA | Modeling Container: The ARIMA Model, Editing Regressor or Formula