g_arima(G;S;O;X;P;D;Q;OPTS)

Fits an ARIMA(P,D,Q) model to the time series data in column X. (Available as of version 19.14)

Function type

Vector only

Syntax

g_arima(G;S;O;X;P;D;Q;OPTS)

Input

Argument Type Description
G any A space- or comma-separated list of column names

Rows are in the same group if their values for all of the columns listed in G are the same.

If G is omitted, all rows are considered to be in the same group.

If any of the columns listed in G contain N/A, the N/A value is considered a valid grouping value.

S integer The name of a column in which every row evaluates to a 1 or 0, which determines whether or not that row is selected to be included in the calculation

If S is omitted, all rows will be considered by the function (subject to any prior row selections).

If any of the values in S are neither 1 nor 0, an error is returned.

O integer A space- or comma-separated list of column names that determine the row order within a particular group

If O is omitted, the order is the current display order of the table.

If any of the values in O are N/A, an error is returned.

X any A column name
P integer The number of lag observations included in the ARIMA model.
D integer The number of times the raw observations are differenced in the ARIMA model.
Q integer The size of the moving average window in the ARIMA model.
OPTS list-value Optional OPTION:VALUE pairs, separated by commas.

OPTION can be method to specify the ARIMA method, optmethod to specify the optimization method, and auto to enable autoARIMA. The default values for OPTS is method:'mle',optmethod:'bfgs',auto:0.

Values for method include the following:
  • 'mle' – use the maximum likelihood estimation method.
  • 'css' – use the conditional sum of squares method.
  • 'box_jenkins' – use the Box-Jenkins Model.
Values for optmethod include the following:
  • 'nelder_mead' – use Nelder-Mead optimization algorithm.
  • 'newton_line_search'
  • 'newton_trust_region_hook_step'
  • 'newton_trust_region_double_dog_leg'
  • ’conjugate_gradient'
  • 'bfgs'
  • ’l_bfgs'
  • ’bfgs_more_thuente_line_search'
Values for auto include:
  • 0 - do not perform AutoARIMA.
  • 1 - perform AutoARIMA. If AutoARIMA is enabled, then the P, D, and Q arguments each specify the maximum values of the respective model parameters to be searched.
The following options are available when auto:1:
  • sta_test - to specify the test used to check stationarity – one of 'kpss' (Kwiatkowski-Phillips-Schmidt-Shin),'df' (Dickey-Fuller), 'adf' (Augmented Dickey-Fuller) or 'pp' (Phillips-Perron); default is 'kpss'.
  • sta_type - to specify the type of stationarity test – one of one of 'level' or 'trend'; default is 'level'.
  • sta_alpha - to specify the α level for the stationarity test – values between 0.0 and 0.10, default is 0.05.
  • sea_test - to specify the test used to test seasonality – one of 'seas' (Rob Hyndman's seasonality heuristics test) or 'ocsb' (Osborn-Chui-Smith-Birchenhall), default is 'seas'.
  • sea_alpha - to specify the α level for the seasonality test - values between 0.0 and 0.10, default is 0.05.
  • stepwise - 0 for full grid search, 1 (default) for stepwise search.
  • approximation - 0 to use slower but more accurate MLE, 1 to use faster but approximate CSS method; the default if this option is not specified depends on number of data points and seasonality/period.

Return Value

For each value of G (and for those rows where S=1, if specfied), g_arima returns an ARIMA model object. Click the model object in the TRS/MLW grid view to see all the parameters of the model object.

The model that g_arima returns can be used as an argument to the following functions:
  • param(M;P;I) to extract the numerical value of the model parameter
  • cparam(M;P;I) to extract the text value of the model parameter
Assuming M is the column containing the result of g_arima, use the following function calls to obtain the desired information:
cparam(M;'model';)
Returns 'arima'
cparam(M;'result';)
Returns 'ok' or 'error' according to whether the fit was successful or not
cparam(M;'message';)
Returns a more detailed message concerning the success or failure of the optimization routine
param(M;'phi';I)
Return the phi parameter from the fitted models (for I between 1 and P inclusive)
param(M;'theta';I)
Return the theta parameter from the fitted models (for I between 1 and Q inclusive)
param(M;'n_used';)
The number of points used in the model (equal to the number of values in X, minus D)
param(M;'n_coeff';)
The number of fitted coefficients, equal to P+Q, plus 1 if mean is non-zero
param(M;'res';I)
Residuals for I between 1 and param(M;'n_used';) inclusive
param(M;'vcov';I J)
Covariance matrix elements for I and J varying between 1 and param(M;'n_coeff';) inclusive