# forecast.midas_r: Forecast MIDAS regression In midasr: Mixed Data Sampling 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 6 7 8 9 10 11 12 13 14``` ```## 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.

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) ```

### Example output ```Loading required package: sandwich
Point Forecast
2012     0.04798328
2013     0.04638829
2014     0.04609471
Point Forecast
2012     0.04598409
2013     0.04446394
2014     0.04355180
Point Forecast
2012     0.04798328
2013     0.04638829
2014     0.04609471

Forecast method: MIDAS regression forecast (static)

Model Information:
MIDAS regression model
model: y ~ trend + fmls(x, 23, 12, nealmon)
(Intercept)       trend          x1          x2          x3
0.0421355  -0.0002936  -0.2333520   0.4611676  -0.0250372

Function optim was used for fitting

Error measures:
ME        RMSE         MAE      MPE     MAPE      MASE
Training set 2.266363e-07 0.008224211 0.006657488 5.453882 43.69982 0.2984747
ACF1
Training set 0.06705183

Forecasts:
Point Forecast
2012     0.04798328
2013     0.04638829
2014     0.04609471
```

midasr documentation built on Feb. 23, 2021, 5:11 p.m.