mpiktas / midasr

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

select_and_forecast Error #61

Closed nriquec closed 6 years ago

nriquec commented 6 years ago

I try use the function select_and_forecast. My model have montlhy data like dependent variable and weekly data like independent variable´s. After wait some minutes I have this error. Error in apply(fc, 1, function(r) sum(r * ww)) : dim(X) must have a positive length.

This is the code:

`modelMIDAS_dos=select_and_forecast(TC~

Monthly

                  mls(DINF, 0, 1,"*")+
                  mls(G12TM,0,1,"*")+
                  #mls(TC, 1, 1)+
                  mls(TO_m, 2,1,"*")+
                  mls(FFR_m, 1:2, 1,"*")+
                  mls(EMBI_m,1, 1,"*")+
                #Weekly
                  mls(EMCI_MXN,0, 4)+
                  mls(VIX, 0, 4)+
                  mls(BCOM,0, 4),
                from=list(
                          EMCI_MXN=c(1),VIX=c(1),
                          BCOM=c(1)),
                to=list(
                        EMCI_MXN=rbind(c(4,12)),VIX=rbind(c(4,12)),
                        BCOM=rbind(c(4,12))
                        ),
               seltype="restricted",
                weights = list(
                                EMCI_MXN=c("nealmon"),VIX=c("nealmon"),BCOM=c("nealmon")
                                ),
                wstart=list(nealmon=rep(0,3)) ,
              IC="AIC",
              ftype = "fixed", 
              measures = c("MSE"),
                insample = 1:144,outsample =145,
                data=list(dlog_men,
                          data.frame(TO_m=dlog_dM$TO,
                                     FFR_m=dlog_dM$FFR,
                                     EMBI_m=dlog_dM$EMBI
                          ),
                          data.frame(EMCI_MXN=dlog_dS$EMCI_MXN,
                                     VIX=dlog_dS$VIX,
                                     BCOM=dlog_dS$BCOM)),
              fweights=c("BICW", "MSFE"))`

Thank´s for all.

vzemlys commented 6 years ago

Could you post the data as well? Also try increasing outsample.

nriquec commented 6 years ago

Outsample was the error. I have only increased the size of outofsame from 145 to 144:145.

Thank´s.