Closed jniedballa closed 4 years ago
It might actually be as simple as: object@stanfit@sim$n_save - object@stanfit@sim$warmup2
In my example with save_warmup = FALSE I have: warmup = 2500 and warmup2 = 0 0 0
So using warmup2 instead of warmup may work. But I am not familiar enough with Stan to know exactly what the differences between warmup and warmup2 actually are. Cheers, Jürgen
I think you nailed it exactly, thanks. I fixed this here: aea7a57. Works now in my tests, let me know if it still doesn't for you. In general I haven't yet extensively tested passing arguments on to stan
. I bet there are some other issues lurking there.
Thank you, predict now works as expected.
On a side not and unrelated, after the update the package assumes a slot @transition
in the submodels which previous versions didn't seem to create. Therefore, when trying to work with models created in previous versions, an error is produced:
Error in .local(object, ...) :
no slot of name "transition" for this object of class "ubmsSubmodel"
So I had to create that slot manually to work on models created with previous versions. Not a big issue, just want to mention it for the sake of backward compatibility.
In case anyone reading this is facing the same issue, this is the code I used to fix it (ubms_fit being the output of stan_occu()):
ubms_fit@submodels@submodels$det@transition <- FALSE
ubms_fit@submodels@submodels$state@transition <- FALSE
Good catch. Now that I've incorporated a dynamic model in the package I should be done making changes to the basic data object structures. I'll try to build in better backwards compatibility if it becomes necessary.
The @transition
backwards compatibility issue should be fixed now, in 0fe12380, which implements a child class for transition-type parameters instead.
Hi Ken, first of all, this is a fabulous package and overall works very well already. Really exciting. Thank you very much for your efforts.
Here's a little problem I encountered. I ran a big model and wished to save disk space by doing:
stan_occu(..., save_warmup = FALSE)
When I tried to use predict(), SD was all NA. I get values for SD though when I don't set save_warmup = FALSE. It turned out that nsamples() (called by predict) returns 0 because:
sum(object@stanfit@sim$n_save - object@stanfit@sim$warmup)
with n_save = 2500 2500 2500 and warmup = 2500I didn't follow the issue further (how exactly it impacts sim_lp etc) but it seems to be the cause of SD being NA in the prediction. Best regards, Jürgen