Closed Olliepike closed 1 month ago
Thanks Ollie. You have discovered a bug in the code: report_sim()
is not working properly when mod_est
or mod_sim
are fitted models. I will fix the bug (by 'unfitting' the models at the start of report_sim()
, and also add a vignette clarifying the aims of report_sim()
, and spelling out the difference from replicate_data()
.
I have fixed the bug where report_sim()
failed if mod_est
or mod_sim
had been fitted.
I have also added a vignette (briefly) explaining how to use report_sim()
.
Hi John, I written some report_sim() examples below that demonstrate the 'subscript out of bounds' error that I encounter. It is very possible that I'm misusing the function, but there potentially could be an issue. Please could you clarify if I am using the function incorrectly?
Working example found in package documentation
Issue example
I understand that report_sim() is an extension of replicate_data(). It can simulate data from the prior predictive distribution of an unfitted model, and also simulate data from the posterior predictive distribution of a fitted model. The documentation only provides an example of an unfitted model simulation so my understanding could be wrong.
A simple example below works for an unfitted model, but fails when simulating data from the fitted model.
Using an unfitted model - works
I understand this to be a way carrying out Prior Predictive Checks - ie assessing whether a model and prior assumptions are reasonable before fitted to data.
Using a fitted model - fails
Using a fitted model fails for n_sim > 1, resulting in a 'subscript out of bounds' error. This result occurs whether set_n_draw() is omitted or included.
Using a 'step1.R' fitted model - fails
You previously shared a 'step1.r' script showcasing the replicate_data() function. Using the births model from that script as an example, the model works for replicate_data(), but likewise fails with report_sim(), resulting in the same 'subscript out of bounds' error.