# ARIMAX.errors.ff: VGLTSMs Family Functions: Generalized integrated regression... In VGAMextra: Additions and Extensions of the 'VGAM' Package

## Description

A VLTSMff for dynamic regression. Estimates regression models with order–(p, d, q) ARIMA errors by maximum likelihood.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ``` ARIMAX.errors.ff(order = c(1, 1, 1), zero = "var", # optionally, "mean". order.trend = 0, include.int = TRUE, diffCovs = TRUE, xLag = 0, include.currentX = TRUE, lvar = "loglink", lmean = "identitylink") ```

## Arguments

 `order` The usual (p, d, q) integer vector as in, e.g., `ARIMAXff`. By default, an order–(p, q) ARMA model is fitted on the errors, whlist d is the degree of differencing on the response. `zero` What linear predictor is modelled as intercept–only? See `zero` and `CommonVGAMffArguments` for further details. `order.trend` Non–negative integer. Allows to incorporate a polynomial trend of order `order.trend` in the forecast mean function. `include.int` Logical. Should an intercept (int) be included in the model for y[t]? Default is `TRUE`. See below for details. `diffCovs` Logical. If `TRUE` (default) the order–`d` difference of the covariates is internally computed and then incorporated in the regression model. Else, only the current values are included. `xLag` Integer. If entered, the covariates, say x[t] are laggeg (up to order `xLag`) and then embedded in the regression model. See below for further details. `include.currentX` Logical. If `TRUE`, the actual values, x[t], are included in the regression model. Else, this is ignored and only the lagged x[t - 1], …, x[t - xLag] will be included. `lvar, lmean` Link functions applied to conditional mean and the variance. Same as `uninormal`.

## Details

The generalized linear regression model with ARIMA errors is another subclass of VGLTSMs (Miranda and Yee, 2018).

For a univariate time series, say y[t], and a p–dimensional vector of covariates x[t] covariates, the model described by this VGLTSM family function is

y[t] = β^T x_t + u[t],

u[t] = θ u[t - 1] + … +θ[p] u[t - p] + z[t] + φ z[t - 1] + … +φ[q] u[t - q].

The first entry in x_t equals 1, allowing an intercept, for every \$t\$. Set `include.int = FALSE` to set this to zero, dimissing the intercept.

Also, if `diffCovs = TRUE`, then the differences up to order `d` of the set x[t] are embedded in the model for y[t]. If `xLag`> 0, the lagged values up to order `xLag` of the covariates are also included.

The random disturbances z[t] are by default handled as N(0, σ[z]^2). Then, denoting Φ[t] as the history of the process (x[t + 1], u[t]) up to time t, yields

E(y[t] | Φ[t - 1]) = β^T x[t] + θ u[t - 1] + … +θ[p] u[t - p] + φ z[t - 1] + … +φ[q] u[t - q].

Denoting μ[t] = E(y[t] | Φ[t - 1]), the default linear predictor for this VGLTSM family function is

η = (μ[t], log σ[t]^2)^T.

## Value

An object of class `"vglmff"` (see `vglmff-class`) to be used by VGLM/VGAM modelling functions, e.g., `vglm` or `vgam`.

## Note

If `d = 0` in `order`, then `ARIMAX.errors.ff` will perform as `ARIMAXff`.

## Author(s)

Victor Miranda

`ARIMAXff`, `CommonVGAMffArguments`, `uninormal`, `vglm`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41``` ```### Estimate a regression model with ARMA(1, 1) errors. ## Covariates are included up to lag 1. set.seed(20171123) nn <- 250 x2 <- rnorm(nn) # One covariate sigma2 <- exp(1.15); theta1 <- 0.5; phi1 <- 0.27 # True coefficients beta0 <- 1.25; beta1 <- 0.25; beta2 <- 0.5 y <- numeric(nn) u <- numeric(nn) z <- numeric(nn) u <- rnorm(1) z <- rnorm(1, 0, sqrt(sigma2)) for(ii in 2:nn) { z[ii] <- rnorm(1, 0, sqrt(sigma2)) u[ii] <- theta1 * u[ii - 1] + phi1 * z[ii - 1] + z[ii] y[ii] <- beta0 + beta1 * x2[ii] + beta2 * x2[ii - 1] + u[ii] } # Remove warm-up values. x2 <- x2[-c(1:100)] y <- y[-c(1:100)] plot(ts(y), lty = 2, col = "blue", type = "b") abline(h = 0, lty = 2) ## Fit the model. ARIMAX.reg.fit <- vglm(y ~ x2, ARIMAX.errors.ff(order = c(1, 0, 1), xLag = 1), data = data.frame(y = y, x2 = x2), trace = TRUE) coef(ARIMAX.reg.fit, matrix = TRUE) summary(ARIMAX.reg.fit, HD = FALSE) # Compare to arima() # arima() can't handle lagged values of 'x2' by default, but these # may entered at argument 'xreg'. arima(y, order = c(1, 0, 1), xreg = cbind(x2, c(0, x2[-150]))) ```