epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

Add options to `plot_seromodel` #202

Open zmcucunuba opened 3 months ago

zmcucunuba commented 3 months ago

Is your feature request related to a problem? Please describe. When using the plot_seromodel function with a constant model, the output is a single seroprevalence plot, rather than a plot showing age/time and r_hat. This makes it challenging to compare with other models using cowplot.

Describe the solution you'd like It would be beneficial if the plot distribution in cowplot could be made consistent with other models. As I’m comparing it with a time-varying model, it would be more straightforward if the Force of Infection (FoI) remained constant over time for a better comparison.

Additional context

ntorresd commented 2 months ago

Thanks for opening this issue, @zmcucunuba! This was raised by other users during our last user test. I agree this would be useful to facilitate model comparison.

For some context, a typical (time model) plot generated by means of plot_seromodel looks like:

image

However, when we plot the results from implementing the "constant" model:

seromodel <- fit_seromodel(
  serosurvey = serosurvey,
  model_type = "constant"
)
plot_seromodel(seromodel, serosurvey)

It looks like:

image

The reason for this is that, in the case of constant FOI models, we only estimate one value of the FOI and its corresponding R-hat, meaning that there is some ambiguity about whether to plot the constant FOI value as a function of age or time (e.g.):

image

The solution for this may be to add an option to plot_seromodel that enables this plot for the constant model case, plotting the FOI and the rhats as a function of time as default when some boolean is TRUE (plot_single_estimates):

plot_seromodel(
  seromodel = seromodel,
  serosurvey = serosurvey,
  plot_single_estimates = TRUE,
  single_estimates_x = "time"
  )

@zmcucunuba, please let me know what you think of this solution.

ntorresd commented 2 months ago

In #200 @ben18785 pointed out that users may want to suppress the summary at the top from the plot generated by plot_seromodel:

With the plotting, is there a way to suppress the written text at the top? I can imagine people wanting to put these into a publication and they may not want the written text.

This can easily be solved by adding an option to include it or not, such that:

plot_seromodel(
  seromodel = seromodel,
  serosurvey = serosurvey,
  plot_single_estimates = TRUE,
  include_summary = FALSE
  )

would return:

image

I want to address this here as its related to plot_seromodel options as well.