normCast {smoots}R Documentation

Forecasting Function for ARMA Models under Normally Distributed Innovations

Description

Point forecasts and the respective forecasting intervals for autoregressive- moving-average (ARMA) models can be calculated, the latter under the assumption of normally distributed innovations, by means of this function.

Usage

normCast(
  X,
  p = NULL,
  q = NULL,
  include.mean = FALSE,
  h = 1,
  alpha = 0.95,
  plot = FALSE,
  ...
)

Arguments

X

a numeric vector that contains the time series that is assumed to follow an ARMA model ordered from past to present.

p

an integer value >= 0 that defines the AR order p of the underlying ARMA(p,q) model within X; is set to NULL by default; if no value is passed to p but one is passed to q, p is set to 0; if both p and q are NULL, optimal orders following the BIC for 0 \leq p,q \leq 5 are chosen; is set to NULL by default; decimal numbers will be rounded off to integers.

q

an integer value >= 0 that defines the MA order q of the underlying ARMA(p,q) model within X; is set to NULL by default; if no value is passed to q but one is passed to p, q is set to 0; if both p and q are NULL, optimal orders following the BIC for 0 \leq p,q \leq 5 are chosen; is set to NULL by default; decimal numbers will be rounded off to integers.

include.mean

a logical value; if set to TRUE, the mean of the series is also estimated; if set to FALSE, E(X_t) = 0 is assumed; is set to FALSE by default.

h

an integer that represents the forecasting horizon; if n is the number of observations, point forecasts and forecasting intervals will be obtained for the time points n + 1 to n + h; is set to 1 by default; decimal numbers will be rounded off to integers.

alpha

a numeric vector of length 1 with 0 < alpha < 1; the forecasting intervals will be obtained based on the confidence level (100alpha)-percent; is set to alpha = 0.95 by default, i.e., a 95-percent confidence level.

plot

a logical value that controls the graphical output; for plot = TRUE, the original series with the obtained point forecasts as well as the forecasting intervals will be plotted; for the default plot = FALSE, no plot will be created.

...

additional arguments for the standard plot function, e.g., xlim, type, ... ; arguments with respect to plotted graphs, e.g., the argument col, only affect the original series X; please note that in accordance with the argument x (lower case) of the standard plot function, an additional numeric vector with time points can be implemented via the argument x (lower case). x should be valid for the sample observations only, i.e. length(x) == length(X) should be TRUE, as future time points will be calculated automatically.

Details

This function is part of the smoots package and was implemented under version 1.1.0. For a given time series X_[t], t = 1, 2, ..., n, the point forecasts and the respective forecasting intervals will be calculated. It is assumed that the series follows an ARMA(p,q) model

X_t - \mu = \epsilon_t + \beta_1 (X_{t-1} - \mu) + ... + \beta_p (X_{t-p} - \mu) + \alpha_1 \epsilon_{t-1} + ... + \alpha_{q} \epsilon_{t-q},

where \alpha_j and \beta_i are real numbers (for i = 1, 2, .., p and j = 1, 2, ..., q) and \epsilon_t are i.i.d. (identically and independently distributed) random variables with zero mean and constant variance. \mu is equal to E(X_t).

The point forecasts and forecasting intervals for the future periods n + 1, n + 2, ..., n + h will be obtained. With respect to the point forecasts \hat{X}_{n + k}, where k = 1, 2, ..., h,

\hat{X}_{n + k} = \hat{\mu} + \sum_{i = 1}^{p} \hat{\beta}_{i} (X_{n + k - i} - \hat{\mu}) + \sum_{j = 1}^{q} \hat{\alpha}_{j} \hat{\epsilon}_{n + k - j}

with X_{n+k-i} = \hat{X}_{n+k-i} for n+k-i > n and \hat{\epsilon}_{n+k-j} = E(\epsilon_t) = 0 for n+k-j > n will be applied.

The forecasting intervals on the other hand are obtained under the assumption of normally distributed innovations. Let q(c) be the 100c-percent quantile of the standard normal distribution. The 100a-percent forecasting interval at a point n + k, where k = 1, 2, ..., h, is given by

[\hat{X}_{n+k} - q(a_r)s_k, \hat{X}_{n+k} + q(a_r)s_k]

with s_k being the standard deviation of the forecasting error at the time point n + k and with a_r = 1 - (1 - a)/2. For ARMA models with normal innovations, the variance of the forecasting error can be derived from the MA(\infty) representation of the model. It is

\sigma_{\epsilon}^{2} \sum_{i=0}^{k - 1} d_{i}^{2},

where d_i are the coefficients of the MA(\infty) representation and \sigma_{\epsilon}^{2} is the innovation variance.

The function normCast allows for different adjustments to the forecasting progress. At first, a vector with the values of the observed time series ordered from past to present has to be passed to the argument X. Orders p and q of the underlying ARMA process can be defined via the arguments p and q. If only one of these orders is inserted by the user, the other order is automatically set to 0. If none of these arguments are defined, the function will choose orders based on the Bayesian Information Criterion (BIC) for 0 \leq p,q \leq 5. Via the logical argument include.mean the user can decide, whether to consider the mean of the series within the estimation process. Furthermore, the argument h allows for the definition of the maximum future time point n + h. Point forecasts and forecasting intervals will be returned for the time points n + 1 to n + h. Another argument is alpha, which is the equivalent of the confidence level considered within the calculation of the forecasting intervals, i.e., the quantiles (1 - alpha)/2 and 1 - (1 - alpha)/2 of the forecasting intervals will be obtained.

For simplicity, the function also incorporates the possibility to directly create a plot of the output, if the argument plot is set to TRUE. By the additional and optional arguments ..., further arguments of the standard plot function can be implemented to shape the returned plot.

NOTE: Within this function, the arima function of the stats package with its method "CSS-ML" is used throughout for the estimation of ARMA models.

Value

The function returns a 3 by h matrix with its columns representing the future time points and the point forecasts, the lower bounds of the forecasting intervals and the upper bounds of the forecasting intervals as the rows. If the argument plot is set to TRUE, a plot of the forecasting results is created.

Author(s)

References

Feng, Y., Gries, T. and Fritz, M. (2020). Data-driven local polynomial for the trend and its derivatives in economic time series. Journal of Nonparametric Statistics, 32:2, 510-533.

Feng, Y., Gries, T., Letmathe, S. and Schulz, D. (2019). The smoots package in R for semiparametric modeling of trend stationary time series. Discussion Paper. Paderborn University. Unpublished.

Feng, Y., Gries, T., Fritz, M., Letmathe, S. and Schulz, D. (2020). Diagnosing the trend and bootstrapping the forecasting intervals using a semiparametric ARMA. Discussion Paper. Paderborn University. Unpublished.

Fritz, M., Forstinger, S., Feng, Y., and Gries, T. (2020). Forecasting economic growth processes for developing economies. Unpublished.

Examples

### Example 1: Simulated ARMA process ###

# Simulation of the underlying process
n <- 2000
n.start = 1000
set.seed(21)
X <- arima.sim(model = list(ar = c(1.2, -0.7), ma = 0.63), n = n,
 rand.gen = rnorm, n.start = n.start) + 7.7

# Application of normCast()
result <- normCast(X = X, p = 2, q = 1, include.mean = TRUE, h = 5,
 plot = TRUE, xlim = c(1971, 2005), col = "deepskyblue4",
 type = "b", lty = 3, pch = 16, main = "Exemplary title")
result

[Package smoots version 1.1.4 Index]