Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull bulk and tail ESS warnings out of EpiNow2 fit #74

Open
Tracked by #181 ...
zsusswein opened this issue Oct 15, 2024 · 10 comments
Open
Tracked by #181 ...

Pull bulk and tail ESS warnings out of EpiNow2 fit #74

zsusswein opened this issue Oct 15, 2024 · 10 comments
Labels

Comments

@zsusswein
Copy link
Collaborator

zsusswein commented Oct 15, 2024

Sam says they look at the minimum of eff_bulk and eff_tail and pull it out over all vars. We could do this for just Rt to start, but we should probably do it for all now that we're looking at more variables.

We should also look at the per-Rt n_eff as a useful metric.

https://github.com/epiforecasts/EpiNow2/blob/2e1aa86598f13364c1af05a5a83b3ac7790db41a/R/summarise.R#L599

@zsusswein zsusswein changed the title Pull bulk and tail ESS warnings out of EpiNow2 fit? What triggers EpiNow2 warnings and do we care? Pull bulk and tail ESS warnings out of EpiNow2 fit Oct 15, 2024
@zsusswein
Copy link
Collaborator Author

cc: @seabbs

@athowes athowes added the good starter issue Could be nice to get up to speed with codebase label Dec 11, 2024
@zsusswein zsusswein mentioned this issue Jan 13, 2025
@kgostic
Copy link
Collaborator

kgostic commented Jan 21, 2025

So, you're proposing that we extract these from the EpiNow2 fit and put them into the diagnostic file? Or that we export them into the flat files (e.g. in the samples file)?

@kgostic
Copy link
Collaborator

kgostic commented Jan 21, 2025

If @natemcintosh takes this one, I or Micah can help mentor, but I need to understand the goal myself first.

@zsusswein
Copy link
Collaborator Author

zsusswein commented Jan 21, 2025

I was thinking we would look at if bulk/tail ESS was low for (1) all parameters and (2) just Rt and sticking that information in the diagnostic file. That should probably be a discrete flag (is_low_neff_all_params_bulk: TRUE/FALSE) and also a quantitative result (neff_per_iter_all_params_bulk: 0.8).

@kgostic
Copy link
Collaborator

kgostic commented Jan 21, 2025

Ok, I'm following the goal. I'm still not 100% following though, whether the issue is that we need to calculate n_eff bulk and tail ourselves, or whether those are already output in the epinow2 object. (Not following reference to this EpiNow2 line of code either: https://github.com/epiforecasts/EpiNow2/blob/2e1aa86598f13364c1af05a5a83b3ac7790db41a/R/summarise.R#L599)

@zsusswein
Copy link
Collaborator Author

Yeah that may have been the wrong link. This one looks better: https://github.com/epiforecasts/EpiNow2/blob/439cf62cdb249f44a7740027511ea3334bce2136/R/extract.R#L303

We shouldn't calculate the statistics ourselves. We should pull them out of the Stan summary object like we do here:

rstan::summary(fit$estimates$fit)$summary[, "Rhat"] > 1.05,

@kgostic
Copy link
Collaborator

kgostic commented Jan 21, 2025

Perfect. Thanks. I can talk @micahwiesner67 through this from here!

@kgostic
Copy link
Collaborator

kgostic commented Jan 22, 2025

@zsusswein I think that @micahwiesner67 has this. Can you just clarify -- do we need to get rid of the rstan dependency around line 77 of the diagnostic.R file you quoted above, or is that bit interoperable with cmdstanr?

@zsusswein
Copy link
Collaborator Author

I'm not sure whether or not it will be interoperable. But I don't think it's necessarily relevant for this issue? In this issue, we should get an approach working to pull out the values from the summary dataframe and in #10 we can work out whether the dataframe is constructed via RStan or with an equivalent cmdstanR function.

@kgostic
Copy link
Collaborator

kgostic commented Jan 22, 2025

Ok, I'm fine with that. But if the goal is to drop the rstan dependency entirely, then we will have to switch eventually.

@zsusswein zsusswein added v0.2.0 and removed v0.1.0 good starter issue Could be nice to get up to speed with codebase labels Jan 23, 2025
@zsusswein zsusswein mentioned this issue Jan 29, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants