Package {forecastADAPT}


Title: Computation of Adaptive Forecast
Version: 0.1.0
Description: The function forAD() implements the adaptive forecasting procedure of Giraitis, Kapetanios and Price (2013) <doi:10.1016/j.jeconom.2013.04.003>. The method can be iterated (e.g., adapt²) and combined with autoregressive (AR) forecasting. These approaches are computationally simple and adapt automatically to structural changes without requiring prior specification of the underlying data-generating process. They are applicable to both stationary and non-stationary time series. The numerical and graphical outputs assist in selecting an appropriate forecasting method, particularly one that minimises mean squared forecast error (MSFE) and yields uncorrelated forecast errors.
License: GPL-3
Encoding: UTF-8
Imports: stats, graphics, lubridate, grDevices, knitr, testcorr, xts, zoo
RoxygenNote: 7.3.3
Suggests: testthat
NeedsCompilation: no
Packaged: 2026-05-05 10:34:53 UTC; drvio
Author: Violetta Dalla [aut, cre], Liudas Giraitis [aut], George Kapetanios [aut]
Maintainer: Violetta Dalla <vidalla@econ.uoa.gr>
Repository: CRAN
Date/Publication: 2026-05-08 14:40:08 UTC

Computing adaptive forecast

Description

The functions forAD computes the adaptive one-step ahead forecast of Giraitis, Kapetanios and Price (2013).

Usage

forAD(x, p_max = 3, T0 = 50, n_v = 100, n_AR = 400,
      plots = TRUE, P = 50, PL = 500, p = 1, date_1 = NULL)

Arguments

x

A univariate numeric time series (ts, xts, zoo) object or a numeric vector or a numeric data frame column.

p_max

Maximum order of the AR model. Default is 3. If set to 0, no AR is estimated.

T0

Length of the training period used to select tuning parameter \rho. Default is 50.

n_v

Length of the period of forecast errors used in calculation of MSFE. Default is 100.

n_AR

Length of the period of forecast errors used for estimation of AR and for computing correlograms. Default is 400.

plots

Logical. If TRUE (default), the following plots are produced:
1) Rolling MSFEs (adapt, adapt+AR(p), adapt^2, adapt^2+AR(p), p=1,...,p_{max}),
2) Rolling tuning parameters \rho (adapt, adapt^2),
3) Rolling one-step ahead forecasts (adapt, adapt+AR(p), adapt^2, adapt^2+AR(p) for selected p) and the data,
4) Rolling forecast errors (adapt, adapt+AR(p), adapt^2, adapt^2+AR(p) for selected p),
5) Correlograms of the forecast errors.
Alternatively, plots can be a logical vector specifying which plots, 1)–5), to display.

P

Length of the period used in plots. Default is 50.

PL

Length of the longer period used in plots. Default is 500.

p

Selected AR order used in plots. Default is 1.

date_1

The date for the one-step ahead forecast when x has dates. Default is NULL.

Details

The method implements the adaptive (one-stage adapt or two-stage adapt^2) one-step ahead forecasting with weights w_{j,\rho}\propto\rho^j for 0<\rho\leq 1 (normalized to sum up to 1) in the 1st step, combined with AR forecasting in 2nd step.

Value

An object of class 'forAD', which is a list with the following components:

for_1

The one-step ahead forecast for all methods (adapt, adapt+AR(p), adapt^2, adapt^2+AR(p), p=1,...,p_{max}).

rho

The tuning parameter for adaptive methods (adapt, adapt^2).

ar_coef_se

The estimated coefficients and their standard errors for the adapt+AR(p), p=1,...,p_{max}.

ar_coef_se_sq

The estimated coefficients and their standard errors for the adapt^2+AR(p), p=1,...,p_{max}.

MSFE

The MSFE for all methods.

for_in

The rolling one-step ahead forecasts for all methods.

rho_in

The rolling tuning parameters for adaptive methods.

MSFE_in

The rolling MSFE for all methods.

err_in

The rolling one-step ahead forecast errors for all methods.

data

The original data.

Note

Missing values are not allowed.
Permitted sample size: N\geq25+2p_{max} when p_max > 0 and N\geq21 when p_max = 0.

Author(s)

Violetta Dalla, Liudas Giraitis and George Kapetanios

References

Giraitis L, Kapetanios G, Price S (2013). "Adaptive Forecasting in the Presence of Recent and Ongoing Structural Change." Journal of Econometrics, 177(2), 153-170. doi:10.1016/j.jeconom.2013.04.003.
Giraitis L, Kapetanios G, Mansur M, Price S (2015). "Forecasting Under Structural Change." In J Beran, Y Feng, H Hebbel (eds.), Empirical Economic and Financial Research: Theory, Methods and Practice, pp. 401–419. Springer International Publishing, Cham. doi:10.1007/978-3-319-03122-4_25.

Examples

# Sample x contains 200 independent standard normal data.
x <- rnorm(200)
print(forAD(x, plots = FALSE))
# Set plots to TRUE to see the plots.
print(forAD(x))