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

Predict is not working on DIRM models #61

Open wpverbeek opened 2 years ago

wpverbeek commented 2 years ago

When estimating Dynamic intercept regression models (DIRM), the predict function does not seem to work. When running the following code:

ss3 <- AddLocalLevel(list(), y_train)
model3<-dirm(y_train~predictor_train, ss3, niter = 250, timestamps = timestamps_train,
             seed = 8675309)
pred3 <- predict(model3, newdata = predictor_val, timestamps=timestamps_val)

I got the error:

Error in if (object$family == "gaussian" || object$family == "student") { : 
  missing value where TRUE/FALSE needed

Inspection of the object leads us to the conclusion that the fields 'family' and 'log.likelihood' seem to be missing: image Estimation using a BSTS instead of DIRM model: image

Is the predict function not supported for DIRM models? The code of dirm.R seems to imply that it should be supported "Put all the regression junk back in, so things like predict() will work". Is this a bug or am I using the wrong routines?

I am using bsts 0.9.7, Boom 0.9.7 and R 4.0.2.