Learn R Programming

VGAMextra (version 0.0-1)

ARIMAX.errors.ff: VGLTSMs Family Functions: Generalized integrated regression with order--\((p, q)\) ARMA errors

Description

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

Usage

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 = "loge",
                       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 \(\boldsymbol{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, \(\boldsymbol{x}_t\), are included in the regression model. Else, this is ignored and only the lagged \(\boldsymbol{x}_{t - 1}, \ldots, \boldsymbol{x}_{t - xLag}\) will be included.

lvar, lmean

Link functions applied to conditional mean and the variance. Same as uninormal.

Value

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

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 \(\boldsymbol{x}_t\) covariates, the model described by this VGLTSM family function is $$ y_t = \boldsymbol{\beta}^T \boldsymbol{x}_t + u_t, $$ $$ u_t = \theta_1 u_{t - 1} + \cdots + \theta_p u_{t - p} + z_t + \phi_1 z_{t - 1} + \cdots + \phi_1 z_{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 \(\boldsymbol{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, \sigma^2_z)\). Then, denoting \(\Phi_{t}\) as the history of the process \((x_{t + 1}, u_t)\) up to time \(t\), yields $$ E(y_t | \Phi_{t - 1}) = \boldsymbol{\beta}^T \boldsymbol{x}_t + \theta_1 u_{t - 1} + \cdots + \theta_p u_{t - p} + \phi_1 z_{t - 1} + \cdots + \phi_1 z_{t - q}. $$

Denoting \(\mu_t = E(y_t | \Phi_{t - 1}),\) the default linear predictor for this VGLTSM family function is $$ \boldsymbol{\eta} = ( \mu_t, \log \sigma^2_{z})^T.$$

See Also

ARIMAXff, CommonVGAMffArguments, uninormal, vglm.

Examples

Run this code
# NOT RUN {
### 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[1] <- rnorm(1)
z[1] <- 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)]

# }
# NOT RUN {
plot(ts(y), lty = 2, col = "blue", type = "b")
abline(h = 0, lty = 2)
# }
# NOT RUN {
## 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)

# }
# NOT RUN {
# 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])))
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab