Open seabbs opened 1 year ago
An example of how this could be done in stan is in https://github.com/epiforecasts/marburg.parameters/blob/main/inst/stan/model.stan
This is the current candidate model for implementation. In the first pass this would be constrained to daily events but should have better scaling with large amounts of data.
There is now an efficient model available in primarycensoreddist
we can wrap + provide nice user interface for. See here: https://primarycensoreddist.epinowcast.org/dev/articles/fitting-dists-with-stan.html#using-pcd_cmdstan_model-for-a-more-efficient-approach
Whilst this is currently several orders of magnitude faster than previous approaches it should shortly get an order of magnitude faster (at least) as we slot in analytical solutions to common primary and delay distribution combinations.
@sbfnk as discussed f2f today
It would make sense to generalise and simplify the current functionality of estimate_delays into a new function called estimate_dist (to highlight it isn't just distributions we are estimating).
Based on lessons learnt in
dynamictruncation
we can now also do quite a bit better with a simple model and support right and potentially left truncation adjustment using the non-latent formulation.This would only require some small adaption of the stan code with the majority of the work being to reduce the current 3 distribution model into one. This would also slightly reduce compilation times which I think everyone would like.
The argument to not making this model is that it can be trivially implemented in
brms
but I think many users may not realise this and there may be value in supplying a simple but still valid model to compete with the simple but not as valid alternatives.