Figures¶
Figure functions for the imported cases paper.
These functions are intended for producing highly customized static figures for a report concerning imported cases in branching process models. For more generally applicable visualizations, please see:
as well as the Dash apps:
- branchpro.figures.plot_forward_simulations(import_cases, R_t_times, R_t, epsilons, simulated_case_data, first_day, show=True)[source]¶
Make a figure showing simulated cases for various values of epsilon.
- It has three panels:
Number of imported cases on each day.
R_t over time.
Simulated local cases for different values of epsilon.
- Parameters:
import_cases (list of int) – Daily incident imported cases, starting on first_day + 1day
R_t_times (list of int) – List of integer time points on which R_t is defined, relative to first_day
R_t (list of float) – Trajectory of reproduction number (local)
epsilons (list of float) – Values of epsilon for which local cases were simulated
simulated_case_data (list of pandas.DataFrame) – For each epsilon, a dataframe giving the simulated local cases. Each dataframe should have the following three columns: ‘Mean’, ‘Lower bound CI’, and ‘Upper bound CI’.
first_day (datetime.datetime) – The first day for simulated local data and imported data
show (bool, optional (True)) – Whether or not to plt.show() the figure after it has been generated
- Return type:
matplotlib.figure.Figure
- branchpro.figures.plot_r_inference(first_day_data, local_cases, import_cases, first_day_inference, epsilons, R_t_results, prior_mid, default_epsilon=1, show=True)[source]¶
Make a figure showing R_t inference for different choices of epsilon.
- It has two panels:
Local and imported cases which were used for inference
Subplots each comparing R_t for one choice of epsilon with the default choice.
Notes
As written this function expects a total of five epsilon values (including the default value).
- Parameters:
first_day_data (datetime.datetime) – First day of incidence data
local_cases (list of int) – Daily incident local cases
import_cases (list of int) – Daily incident imported cases
first_day_inference (datetime.datetime) – First day of inference results
epsilons (list of float) – Values of epsilon for which inference was performed
R_t_results (list of pandas.DataFrame) – For each epsilon, a dataframe giving the inference results for R_t. It must have the three columns ‘Mean’, ‘Lower bound CI’, and ‘Upper bound CI’.
prior_mid (float) – The prior median of R_t
default_epsilon (float, optional (1)) – The value of epsilon whose inference results will be compared to the results from all other values of epsilon.
show (bool, optional (True)) – Whether or not to plt.show() the figure after it has been generated
- Return type:
matplotlib.figure.Figure