steve-the-bayesian / BOOM

A C++ library for Bayesian modeling, mainly through Markov chain Monte Carlo, but with a few other methods supported. BOOM = "Bayesian Object Oriented Modeling". It is also the sound your computer makes when it crashes.
GNU Lesser General Public License v2.1
35 stars 14 forks source link

R crashing with Google xts/zoo examples #36

Closed furchtgott closed 5 years ago

furchtgott commented 5 years ago

R crashes with the "fatal error" message when I try the Google example. I have tried this in R 3.5.1 and 3.6.0. I also tried converting goog to zoo but I am getting the same behavior.

data(goog) ss <- AddSemilocalLinearTrend(list(), goog) model <- bsts(goog, state.specification = ss, niter = 500)

steve-the-bayesian commented 5 years ago

Thanks for the bug report. I'll investigate.

On Mon, Jun 3, 2019 at 9:37 AM furchtgott notifications@github.com wrote:

R crashes with the "fatal error" message when I try the Google example. I have tried this in R 3.5.1 and 3.6.0. I also tried converting goog to zoo but I am getting the same behavior.

data(goog) ss <- AddSemilocalLinearTrend(list(), goog) model <- bsts(goog, state.specification = ss, niter = 500)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/steve-the-bayesian/BOOM/issues/36?email_source=notifications&email_token=ABMVDVNRLHSXCRO7ES3OT43PYVCCXA5CNFSM4HSJY6L2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GXKSKLA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMVDVPSGK5XN246R4LKUW3PYVCCXANCNFSM4HSJY6LQ .

steve-the-bayesian commented 5 years ago

This code works: set.seed(8675309) library(bsts) data(goog) goog <- as.numeric(goog) ## LOOK HERE ss <- AddSemilocalLinearTrend(list(), goog) model <- bsts(goog, ss, niter = 50)

This code crashes: set.seed(8675309) library(bsts) data(goog) goog <- zoo(as.numeric(goog), index(goog)) . #### LOOK HERE ss <- AddSemilocalLinearTrend(list(), goog) Model <- bsts(goog, ss, niter = 50)

This indicates that the problem has something to do with handling timestamps in zoo objects. XTS is a generalization of zoo, so fixing one likely fixes the other.

steve-the-bayesian commented 5 years ago

Found the bug. An offset translating from R to C indexing was being subtracted twice.

steve-the-bayesian commented 5 years ago

I'll get this fix live on CRAN ASAP. It might take a week to get through their processes. In the mean time if anyone needs the updated source just send an email.

steve-the-bayesian commented 5 years ago

bsts bug fix accepted to CRAN on 6/7/2019