ArimaR(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;
Input. Output variable.
Period. Period, at which the method is calculated
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.
The ArimaR method models variable values using the ARIMA method using the R package.
Integration with R must be set up in the repository to use this method. To set up integration, see the How to Set Up Integration with R? section.
Features of setting parameters:
ConstantValue. The value of the constant can be determined by the user or estimated automatically. Use the IModelling.Estimate method to estimate values automatically. If a model must be calculated without constant, use the IModelling.None method.
Period. If the parameter is set to Null, the method is calculated at the entire time period.
Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D identifier that is calculated by the determinate equation method and contains at least one input variable.
Integration with R must be set up in the repository. To set up integration, see the How to Set Up Integration with R? section.
Add links to the Metabase and Ms system assemblies.
Sub UserArimaR;
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 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 := "ArimaR(" + TermInfo.TermInnerText + ", SetPeriod(" +
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
"), 0, 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 UserArimaR;
After executing the example the model calculates value of the first input variable by the ARIMA method. The following will be set for the method: calculation period, autoregression and moving average orders. The constant will be estimated automatically. Missing data will be treated using the Casewise method. Calculation will be executed using the R package.
Expression 1:
ArimaR({Chicago - population[t]}, SetPeriod(2000, 2015), 0, 1, 1, Estimate)
Result: the ARIMA method is calculated for the Chicago - population time series with the following parameters: calculation period - 2000-2015, non-seasonal autoregression order - 0, non-seasonal moving average order - 1, non-seasonal difference order - 1, constant value is auto estimated with the IModelling.Estimate method. Calculation is executed using the R package.
Use: it can be used in formulas of cross functional expression editor in any platform tool where it is available.
Expression 2:
ArimaR(X1,Null, 0, 0, 1, 2.7, 0, 0, 1, 0, 500, 0.0001, MsCasewise.Yes)
Result: the ARIMA method is calculated for the X1 factor with the following parameters: orders of non-seasonal autoregression and non-seasonal moving average are not defined, non-seasonal difference order - 1, constant value is equal to 2,7, the Casewise method is used for missing data treatment. Calculation is executed using the R package.
Use: it can be used in model formulas of modeling container based on variables.
See also:
IModelling | The ARIMA Method | Time Series Database: Calculator, ARIMA | Modeling Container: The ARIMA Model, Editing Regressor or Formula