Forecast MIDAS regression

Description

Forecasts MIDAS regression given the future values of regressors. For dynamic models (with lagged response variable) there is an option to calculate dynamic forecast, when forecasted values of response variable are substituted into the lags of response variable.

Usage

1
2
3
4
5
## S3 method for class 'midas_r'
forecast(object, newdata = NULL, se = FALSE,
  level = c(80, 95), fan = FALSE, npaths = 999, method = c("static",
  "dynamic"), insample = get_estimation_sample(object),
  show_progress = TRUE, add_ts_info = FALSE, ...)

Arguments

object

midas_r object

newdata

a named list containing future values of mixed frequency regressors. The default is NULL, meaning that only in-sample data is used.

se

logical, if TRUE, the prediction intervals are calculated

level

confidence level for prediction intervals

fan

if TRUE, level is set to seq(50,99,by=1). This is suitable for fan plots

npaths

the number of samples for simulating prediction intervals

method

the forecasting method, either "static" or "dynamic"

insample

a list containing the historic mixed frequency data

show_progress

logical, if TRUE, the progress bar is shown if se = TRUE

add_ts_info

logical, if TRUE, the forecast is cast as ts object. Some attempts are made to guess the correct start, by assuming that the response variable is a ts object of frequency 1. If FALSE, then the result is simply a numeric vector.

...

additional arguments to simulate.midas_r

Details

Given future values of regressors this function combines the historical values used in the fitting the MIDAS regression model and calculates the forecasts.

Value

an object of class "forecast", a list containing following elements:

method

the name of forecasting method: MIDAS regression, static or dynamic

model

original object of class midas_r

mean

point forecasts

lower

lower limits for prediction intervals

upper

upper limits for prediction intervals

fitted

fitted values, one-step forecasts

residuals

residuals from the fitted model

x

the original response variable

The methods print, summary and plot from package forecast can be used on the object.

Author(s)

Vaidotas Zemlys

Examples

 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
data("USrealgdp")
data("USunempr")

y <- diff(log(USrealgdp))
x <- window(diff(USunempr), start = 1949)
trend <- 1:length(y)

##24 high frequency lags of x included
mr <- midas_r(y ~ trend + fmls(x, 23, 12, nealmon), start = list(x = rep(0, 3)))

##Forecast horizon
h <- 3
##Declining unemployment
xn <- rep(-0.1, 12*h)
##New trend values
trendn <- length(y) + 1:h

##Static forecasts combining historic and new high frequency data
forecast(mr, list(trend = trendn, x = xn), method = "static")

##Dynamic AR* model
mr.dyn <- midas_r(y ~ trend + mls(y, 1:2, 1, "*")
                   + fmls(x, 11, 12, nealmon),
                  start = list(x = rep(0, 3)))

forecast(mr.dyn, list(trend = trendn, x = xn), method = "dynamic")

##Use print, summary and plot methods from package forecast

fmr <- forecast(mr, list(trend = trendn, x = xn), method = "static")
fmr
summary(fmr)
plot(fmr)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.