mpiktas / midasr

R package for mixed frequency time series data analysis.
http://mpiktas.github.io/midasr/
Other
74 stars 34 forks source link

midasR forecast produces NA value #63

Open nriquec opened 6 years ago

nriquec commented 6 years ago

I want a forecast 1-step with Midas Package, but when i try to do the result are NA. The code are the next. model1=midas_r(TC ~ mls(TC, 1, 1)+ mls(EMCI_MXN, 2:5, 4, nealmon) , data=list(dlog_men, EMCI_MXN=dlog_dS$EMCI_MXN), start = list(EMCI_MXN=rep(0,3))) model2=midas_r(TC ~ mls(TC, 1, 1)+ mls(EMCI_MXN, 2:5, 4, lcauchyp) , data=list(dlog_men, EMCI_MXN=dlog_dS$EMCI_MXN), start = list(EMCI_MXN=c(1,1,1))) model_frcst= midasr::forecast(model2, newdata=list( EMCI_MXN =c(-.02,rep(NA,3)) #Adding new value ),method="dynamic") I´ve tried this, but the result is the same: average_forecast(list(model1, model2),data=list( TC=c(dlog_men$TC, NA), EMCI_MXN =c(dlog_dS$EMCI_MXN,rep(NA,4)) ), insample= 1:146, outsample = 147 )

Thank´s a lot

nriquec commented 6 years ago

Data below dlog_dS.xlsx dlog_men.xlsx

cumpaz commented 5 years ago

Hey! I don’t know if the post fits the right subject here. I am using average_forecast function to perform one-step forecast based on previous estimated models. I see that select_and_forecast function can do one-step, two-step,... forecast by first selecting the best model. What I would like to do is to do the same thing that select_and_forecast function (such as forecast at h-step-ahead) but with previous selected models as in average_forecast. In other words, I don’t to do the select step. How can I change the code in this way? Thanks for the help.

vzemlys commented 5 years ago

@cumpaz could you please provide the reproducible example, so that it is more clearer of what are you trying to achieve?