Natsiopoulos / ARDL

ARDL, ECM and Bounds-Test for Cointegration
GNU General Public License v3.0
17 stars 9 forks source link

auto.ardl() error message #4

Closed omzeybek closed 2 years ago

omzeybek commented 3 years ago

Hi,

I am very interested in your ARDL package. To understand it's components I ran data(denmark) example you gave in documentation. Everything was fine with example data set, except exogenous variable issue I asked in my previous question. But when I turned to my real data which in zooreg data frame type and containing numeric variables. I started receving the following error. Both tow variables I used for analysis doesn't includes missing values and they are in logarithmic form.

models <- auto_ardl(gunluk_miktar~ promotion_depth,data=dfzooreg,max_order = 2)

> summary(dfzooreg$gunluk_miktar)
     Index            dfzooreg$gunluk_miktar
 Min.   :2016-12-31    9.167642:   2                  
 1st Qu.:2016-12-31    8.212196:   1                  
 Median :2017-01-01    8.303579:   1                  
 Mean   :2017-01-01    8.416710:   1                  
 3rd Qu.:2017-01-02    8.499335:   1                  
 Max.   :2017-01-03    8.510974:   1                  
                      (Other)  :1180                  
> summary(dfzooreg$promotion_depth)
     Index            dfzooreg$promotion_depth
 Min.   :2016-12-31    0.000000e+00:530                 
 1st Qu.:2016-12-31    1.003535e-01:  1                 
 Median :2017-01-01    1.005252e-05:  1                 
 Mean   :2017-01-01    1.008855e-03:  1                 
 3rd Qu.:2017-01-02    1.008994e-02:  1                 
 Max.   :2017-01-03    1.009195e-01:  1                 
                      (Other)      :652  

I am not sure what's the problem but I am receving the error message bellow.

Error in list(order2_back, order2_forth)[which(c(selection_m2_back, selection_m2_forth) == : subscript out of bounds In addition: Warning messages: 1: In model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored 2: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors 3: In Ops.factor(res, 2) : ‘^’ not meaningful for factors 4: In model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored 5: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors 6: In Ops.factor(res, 2) : ‘^’ not meaningful for factors 7: In model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored 8: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors 9: In Ops.factor(res, 2) : ‘^’ not meaningful for factors

If it's possible I kindly need a help on error handling

thank you very much for your help

Natsiopoulos commented 3 years ago

Hi, thank you for your interest in the package.

I run the auto_ardl() function in debug mode and I managed to reproduce the following error: Error in list(order2_back, order2_forth)[which(c(selection_m2_back, selection_m2_forth) == : subscript out of bounds

Assuming that this is the cause of your problem too, here is what I think.

Not sure if this is indeed the problem. If it is, it is primarily a problem with the criterion. Naturally, an NA value can not be compared with another numeric value, and so the auto_ardl() function can not decide which one to choose.

I hope you find a workaround for this problem. In any case, lets me know if you have any new insights.

As for the warnings, I'm not sure that is the problem here. It seems like it can't handle some factor variables, but again this has to do with the regression model and not with the package. A small dataset would be helpful so I can reproduce it.

Regards