epiforecasts / EpiNow2

Estimate Realtime Case Counts and Time-varying Epidemiological Parameters
https://epiforecasts.io/EpiNow2/dev/
Other
113 stars 32 forks source link

Prior(s) for R #613

Closed sbfnk closed 7 months ago

sbfnk commented 7 months ago

At the moment every element of the R vector has a lognormal prior https://github.com/epiforecasts/EpiNow2/blob/19b57074f82765ee34e7b7b8a9b7226c3e2624e9/inst/stan/functions/rt.stan#L46

That seems wrong in many cases as all elements of that vector except the first one already have a Gaussian Process / random walk prior if these models are used - in that case only the first elements should have the lognormal prior.

seabbs commented 7 months ago

This would be quite a bad bug if it were the case but I think it is not.

I think that log_R is the initial intercept and is only of length one (https://github.com/epiforecasts/EpiNow2/blob/19b57074f82765ee34e7b7b8a9b7226c3e2624e9/inst/stan/estimate_infections.stan#L45)

This is then broadcast to t in : https://github.com/epiforecasts/EpiNow2/blob/19b57074f82765ee34e7b7b8a9b7226c3e2624e9/inst/stan/functions/rt.stan#L36

Should definitely chase this up as I agree this would be very bad for performance and also from an interpretation point of view.

sbfnk commented 7 months ago

You're right. My bad, sorry!