arima_model {gratis}R Documentation

Specify parameters for an ARIMA model

Description

This function allows the parameters of a Gaussian ARIMA(p,d,q)(P,D,Q)[m] process to be specified. The output can be used in simulate.Arima() and generate.Arima. If any argument is NULL, the corresponding parameters are randomly selected. The AR and MA orders p and q are chosen from {0,1,2,3}, the seasonal AR and MA orders P and Q are from {0,1,2}, while the order of differencing, d is in {0,1,2}, and the order of seasonal differencing D is in {0,1}, with the restriction that d+D \le 2. If constant is NULL, it is set to 0 if d+D = 2, otherwise it is uniformly sampled on (-3,3). The model orders and the parameters are uniformly sampled. The AR and MA parameters are selected to give stationary and invertible processes when d=D=0. The noise variance sigma is uniformly sampled on (1,5). The parameterization is as specified in Hyndman & Athanasopoulos (2021).

Usage

arima_model(
  frequency = 1,
  p = NULL,
  d = NULL,
  q = NULL,
  P = NULL,
  D = NULL,
  Q = NULL,
  constant = NULL,
  phi = NULL,
  theta = NULL,
  Phi = NULL,
  Theta = NULL,
  sigma = NULL
)

Arguments

frequency

The length of the seasonal period (e.g., 12 for monthly data).

p

An integer equal to the non-seasonal autoregressive order

d

An integer equal to the non-seasonal order of differencing

q

An integer equal to the non-seasonal moving average order

P

An integer equal to the seasonal autoregressive order

D

An integer equal to the seasonal order of differencing

Q

An integer equal to the seasonal moving average order

constant

The intercept term

phi

A numeric p-vector containing the AR parameters.

theta

A numeric p-vector containing the MA parameters.

Phi

A numeric p-vector containing the seasonal AR parameters.

Theta

A numeric p-vector containing the seasonal MA parameters.

sigma

The standard deviation of the noise.

Value

An 'Arima' object as described in the arima function from the stats package.

Author(s)

Rob J Hyndman

See Also

simulate.Arima

Examples

# An AR(2) model with random parameters
model1 <- arima_model(p = 2, d = 0, q = 0)
# An AR(2) model with specific parameters
model2 <- arima_model(p = 2, d = 0, q = 0, phi = c(1.34, -0.64), sigma = 15)
# Seasonal ARIMA model with randomly selected parameters
model3 <- arima_model(frequency = 4)
# Simulate from each model and plot the results
library(forecast)
simulate(model1, 100) %>% plot()
simulate(model2, 100) %>% plot()
simulate(model3, 100) %>% plot()

[Package gratis version 1.0.7 Index]