IModelling.Arima

Syntax

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;

Parameters

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.

Description

The Arima method models variable values with the help of ARIMA method.

Comments

Features of setting parameters:

Example

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 factor.

Add links to the Metabase and 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 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 handled using the Casewise method.

Example of Use in Expressions

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: non-seasonal autoregression order is 1-3, non-seasonal moving average order 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 cross functional expression editor in any platform tool where it is available.

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: non-seasonal autoregression and non-seasonal moving average orders are not set, non-seasonal difference order is 1, constant value is 2,7, calculation is executed at the entire period without considering missing values.

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