simulate.midas_r {midasr} | R Documentation |
Simulate MIDAS regression response
Description
Simulates one or more responses from the distribution corresponding to a fitted MIDAS regression object.
Usage
## S3 method for class 'midas_r'
simulate(
object,
nsim = 999,
seed = NULL,
future = TRUE,
newdata = NULL,
insample = NULL,
method = c("static", "dynamic"),
innov = NULL,
show_progress = TRUE,
...
)
Arguments
object |
|
nsim |
number of simulations |
seed |
either NULL or an integer that will be used in a call to set.seed before simulating the time series. The default, NULL will not change the random generator state. |
future |
logical, if |
newdata |
a named list containing future values of mixed frequency regressors. The default is |
insample |
a list containing the historic mixed frequency data |
method |
the simulation method, if |
innov |
a matrix containing the simulated innovations. The default is |
show_progress |
logical, TRUE to show progress bar, FALSE for silent evaluation |
... |
not used currently |
Details
Only the regression innovations are simulated, it is assumed that the predictor variables and coefficients are fixed. The innovation distribution is simulated via bootstrap.
Value
a matrix of simulated responses. Each row contains a simulated response.
Author(s)
Virmantas Kvedaras, Vaidotas Zemlys
Examples
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)))
simulate(mr, nsim=10, future=FALSE)
##Forecast horizon
h <- 3
##Declining unemployment
xn <- rep(-0.1, 12*3)
##New trend values
trendn <- length(y) + 1:h
simulate(mr, nsim = 10, future = TRUE, newdata = list(trend = trendn, x = xn))