0

I have an ARDL model with co-integration so I used the "dynamac" package in R. I need to forecast for some horizons (different at each time). When I apply the forecast function from the package "forecast" an error occurs due to the fact that the "new data" were not imported.

ARDL_Model <- dynamac::dynardl(Y ~ X1 + X2 + X3 + X4 , data = My_Data,
                                   diffs = c("X1","X2", "X3","X4"),
                                   lagdiffs = list("X1" = c(1:5),"X2" = 1, "X3" = c(1:2), "X4" = c(1:2)), ec = TRUE, simulate = TRUE,shockvar = "X2", graph= TRUE)

forecast(All_ARDL_Model$model,h=1)#Horizon 1

R output - (forecast command): Error in as.data.frame(newdata) : argument "newdata" is missing, with no default

4

1 回答 1

1

也许我误解了你的问题,但你的代码已经包含了相关的预测。

ARDL_Model <- dynamac::dynardl(Y ~ X1 + X2 + X3 + X4 , data = My_Data,
diffs = c("X1","X2", "X3","X4"),
lagdiffs = list("X1" = c(1:5), "X2" = 1, "X3" = c(1:2), "X4" = c(1:2)), 
ec = TRUE, simulate = TRUE, shockvar = "X2", graph= TRUE)

将在 中创建一组模拟结果ARDL_Model$simulateARDL_Model$simulate$central是因变量的响应。在shocktime(由于此处未指定将默认为 t = 10),X2将对其值的标准偏差感到震惊(由于shockval未指定)。其他变量将在他们的手段。因此,您将能够预测因变量的响应,但需要运行单独的模拟(即,对于每个shockvar并且shockval您希望预测响应)。

https://cran.r-project.org/web/packages/dynamac/vignettes/dynamac-vignette.html上的小插图也可能有用。

于 2019-03-27T18:31:03.753 回答