predict.midas_r: Predict method for MIDAS regression fit

Description Usage Arguments Details Value Author(s) Examples

View source: R/midas_r_methods.R

Description

Predicted values based on midas_r object.

Usage

1
2
## S3 method for class 'midas_r'
predict(object, newdata, na.action = na.omit, ...)

Arguments

object

midas_r object

newdata

a named list containing data for mixed frequencies. If omitted, the in-sample values are used.

na.action

function determining what should be done with missing values in newdata. The most likely cause of missing values is the insufficient data for the lagged variables. The default is to omit such missing values.

...

additional arguments, not used

Details

predict.midas_r produces predicted values, obtained by evaluating regression function in the frame newdata. This means that the appropriate model matrix is constructed using only the data in newdata. This makes this function not very convenient for forecasting purposes. If you want to supply the new data for forecasting horizon only use the function forecast.midas_r. Also this function produces only static predictions, if you want dynamic forecasts use the forecast.midas_r.

Value

a vector of predicted values

Author(s)

Virmantas Kvedaras, Vaidotas Zemlys

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data("USrealgdp")
data("USunempr")

y <- diff(log(USrealgdp))
x <- window(diff(USunempr), start = 1949)

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

##Declining unemployment
xn <- rnorm(2 * 12, -0.1, 0.1)

##Only one predicted value, historical values discarded
predict(mr, list(x = xn))

##Historical values taken into account
forecast(mr, list(x = xn))

Example output

Loading required package: sandwich
Loading required package: optimx
[1] 0.05975278
     Point Forecast
2012     0.05638813
2013     0.05975278

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