epinowcast / epidist

An R package for estimating epidemiological delay distributions
http://epidist.epinowcast.org/
Other
12 stars 4 forks source link

Any more Stan or `brms` functionality we can use? #77

Closed athowes closed 2 weeks ago

athowes commented 4 months ago

In this package we are injecting custom Stan code to allow us to fit the models we would like to fit.

It would be preferable if we didn't do this, and instead relied on existing Stan or brms functionality where exists.

We should investigate:

athowes commented 2 months ago

According to https://mc-stan.org/docs/stan-users-guide/truncation-censoring.html#truncation.section:

We have the code:

family_lpdf(d | mu, sigma) - family_lcdf(obs_time | mu, sigma);

I guess that we could rewrite this as:

family_lpdf(d | mu, sigma) T[0, obs_time];

In some sense, this is nice. It makes it clearer what is going on. In another sense, what is the point? Do we have any way of getting out of the custom functions? Need this to be in brms.

athowes commented 2 months ago

brms apparently does allow for both truncation and censoring: https://github.com/paul-buerkner/brms/issues/172

athowes commented 2 months ago

I tried using T[] in #202 to replace some part of the text in functions.stan but found it challenging to do and dropped it.

seabbs commented 2 months ago

it doesn't support double event censoring. The censoring support with truncation was used in one of the models we showcase in the paper (the uniform approx)

seabbs commented 2 weeks ago

I'd suggest we close this as won't do?