config-i1 / smooth

The set of functions used for time series analysis and in forecasting.
89 stars 20 forks source link

smooth::auto.ces() failing #191

Closed alsabtay closed 2 years ago

alsabtay commented 2 years ago

I get the following error Error in costfunc(matvt, matF, matw, yInSample, vecg, h, lagsModel, Etype, : Mat::operator(): index out of bounds

The code I run : library(smooth) install.packages("https://github.com/carlanetto/M4comp2018/releases/download/0.2.0/M4comp2018_0.2.0.tar.gz", repos=NULL) library(M4comp2018) y = ts(M4[[95008]]$x, start = start(M4[[95008]]$x), frequency = 52) fcs2 = smooth::auto.ces(y, h=M4[[95008]]$h, interval="parametric", level=0.95)

Note: 1) R 4.1.2 installed 2) latest CRAN versions of required packages installed 3) M1 Macbook

config-i1 commented 2 years ago

Sorry, but I cannot reproduce this error. Here is the model that I get:

Time elapsed: 1.33 seconds Model estimated: CES(f) a0 + ia1: 1.1172+0.9988i b0 + ib1: 1.35+0.978i Initial values were produced using backcasting.

Loss function type: likelihood; Loss function value: 13399.8562 Error standard deviation: 933.3974 Sample size: 1623 Number of estimated parameters: 5 Number of degrees of freedom: 1618 Information criteria: AIC AICc BIC BICc 26809.71 26809.75 26836.67 26836.81

95% parametric prediction interval was constructed

I get this with smooth v3.1.4 and greybox v1.0.2. I work on Linux and cannot try it on Mac right now. If I get access to it and manage to reproduce, I will see how to fix this.

By the way, what version of RcppArmadillo do you have installed?

alsabtay commented 2 years ago

I have installed RcppArmadillo v0.10.8.1.0, Rcpp v1.0.8, smooth v3.1.4, and greybox v1.0.2.

alsabtay commented 2 years ago

I have just updated smooth and greybox. Then, I tried it on Win10-64 and M1 MacOs Monterey 12.1, I got same error.

(I have installed RcppArmadillo v0.10.8.1.0, Rcpp v1.0.8, smooth v3.1.5, and greybox v1.0.3)

config-i1 commented 2 years ago

Thanks! I'll investigate.

config-i1 commented 2 years ago

Can you please check the most recent version from github by installing it via remotes::install_github("config-i1/smooth")? This should fix it.

alsabtay commented 2 years ago

It works. Thank you for support.

alsabtay commented 2 years ago

Hello again,

While I was working on M4 Weekly dataset, I got same error: Error in costfunc(matvt, matF, matw, yInSample, vecg, h, lagsModel, Etype, : Mat::operator(): index out of bounds

The code I run : library(smooth) library(M4comp2018) y = ts(M4[[95168]]$x, start = start(M4[[95168]]$x), frequency = 52) fcs2 = smooth::auto.ces(y, h=M4[[95168]]$h, interval="parametric", level=0.95)

I tried it on Win10-64 and M1 MacOs Monterey 12.1, I got same error on both systems.

I have installed RcppArmadillo v0.10.8.1.0, Rcpp v1.0.8, smooth v3.1.6.41001, greybox v1.0.3 and forecast v8.16.

config-i1 commented 2 years ago

I'll check, thanks.

config-i1 commented 2 years ago

v3.1.6.41004 (95e1be1489900ac93cedeb9a5249c65c4b33c31d) should now fix the issue. Thank you for reporting the bug!

alsabtay commented 2 years ago

Thank you for quick response. However, I got same error for another weekly data. The M4[[95008]] serie didn't fail before while using smooth v3.1.6.41001.

The code I run : library(smooth) library(M4comp2018) y = ts(M4[[95008]]$x, start = start(M4[[95008]]$x), frequency = 52) smooth::auto.ces(y, h=M4[[95008]]$h, interval="parametric", level=0.95)

I have installed RcppArmadillo v0.10.8.1.0, Rcpp v1.0.8, smooth v3.1.6.41004, greybox v1.0.4 and forecast v8.16.

config-i1 commented 2 years ago

When I run the code above, I get this:

image

What error do you get? Surely, it cannot be the same one, because I fixed the C++ issue. Also, make sure that you restart R after reinstalling the package.

alsabtay commented 2 years ago

After I restarted R and reinstalled the packages (smooth and M4comp2018), I got below error message:

M4 with smooth package
config-i1 commented 2 years ago

I hate errors that are difficult to reproduce!

Can you please provide the output of the command: Sys.info()

config-i1 commented 2 years ago

Forget about the previous comment.

This should be fixed in 428cd7ddce6548b6e50ce08853987347ae911bce now. I really-really hope that that's it. :) Thank you for the patience! Let me know if you find any other issues.

Note that in order to install the new version of smooth, you would also need to install new version of greybox.

alsabtay commented 2 years ago

Sys.info()

_sysname "Darwin" release "21.2.0" version "Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64T8101" nodename "alsabtayx-MacBook-Air.local" machine "arm64" login "root"

alsabtay commented 2 years ago

Forget about the previous comment.

This should be fixed in 428cd7d now. I really-really hope that that's it. :) Thank you for the patience! Let me know if you find any other issues.

Note that in order to install the new version of smooth, you would also need to install new version of greybox.

I'm getting the same error for M4[[95008]] dataset on both Win10-64 and MacOS M1

config-i1 commented 2 years ago

How about now? 38f1f349f9ed2d9170d7e824b0a9f12079df4bb6 This works on my Windows Laptop.

alsabtay commented 2 years ago

It works on both of Win10-64 and M1 macOS. Thank you for support.