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

reorder_studies function is dropping rows #73

Closed
thomrawson opened this issue Jun 6, 2024 · 1 comment · Fixed by #100
Closed

reorder_studies function is dropping rows #73

thomrawson opened this issue Jun 6, 2024 · 1 comment · Fixed by #100
Assignees
Labels
bug Something isn't working urgent This needs immediate attention

Comments

@thomrawson
Copy link
Collaborator

When we feed parameters into a forest_plot, it automatically runs them through "reorder_studies" to plot them from highest to lowest. However, it also does this by country. If a parameter has NA for country, it currently cuts that parameter. (drops that row). We don't want this happen.

Rather, we want it to include all by default, and have users say if they want to order by country, and then have a way to make sure NAs aren't removed still.

ebola_df <- load_epidata('ebola')
ebola_params <- ebola_df[["params"]]

forest_plot_infectious_period(ebola_params)

ebola_params <- ebola_params[ebola_params$parameter_type %in% c("Human delay - infectious period",
                                                   "Human delay - infectious period  (inverse parameter)"), ]
#So, seven params, but only six got plotted above, we're missing a 21.6 estimate

ebola_params <- reparam_gamma(ebola_params) |>
  invert_inverse_params() |>
  delays_to_days() |>
  param_pm_uncertainty()

#Now, enforce the bug, set Yang (2015) (the first one)
ebola_params$population_country[1] <- NA
#We have 25 rows...
forest_plot_infectious_period(ebola_params)
#Yang has gone missing!

#THis is because of reorder_studies:
ebola_params <- reorder_studies(ebola_params)
@thomrawson thomrawson added bug Something isn't working urgent This needs immediate attention labels Jun 6, 2024
@sangeetabhatia03 sangeetabhatia03 linked a pull request Jun 28, 2024 that will close this issue
@thomrawson
Copy link
Collaborator Author

Issue now fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent This needs immediate attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants