Plotting

covid19_inference.plotting.get_all_free_RVs_names(model)[source]

Returns the names of all free parameters of the model

Parameters

model (pm.Model instance) –

Returns

list – all variable names

covid19_inference.plotting.get_prior_distribution(model, x, varname)[source]

Given a model and variable name, get the prior that was used for modeling.

Parameters
  • model (pm.Model instance) –

  • x (list or array) –

  • varname (string) –

Returns

array – the prior distribution evaluated at x

covid19_inference.plotting.plot_hist(model, trace, ax, varname, colors=('tab:blue', 'tab:orange'), bins=50)[source]

Plots one histogram of the prior and posterior distribution of the variable varname.

Parameters
  • model (pm.Model instance) –

  • trace (trace of the model) –

  • ax (matplotlib.axes instance) –

  • varname (string) –

  • colors (list with 2 colornames) –

  • bins (number or array) – passed to np.hist

Returns

None

covid19_inference.plotting.plot_cases(trace, new_cases_obs, date_begin_sim, diff_data_sim, start_date_plot=None, end_date_plot=None, ylim=None, week_interval=None, colors=('tab:blue', 'tab:orange'), country='Germany')[source]

Plots the new cases, the fit, forecast and lambda_t evolution

Parameters
  • trace (trace returned by model) –

  • new_cases_obs (array) –

  • date_begin_sim (datetime.datetime) –

  • diff_data_sim (float) – Difference in days between the begin of the simulation and the data

  • start_date_plot (datetime.datetime) –

  • end_date_plot (datetime.datetime) –

  • ylim (float) – the maximal y value to be plotted

  • week_interval (int) – the interval in weeks of the y ticks

  • colors (list with 2 colornames) –

Returns

figure, axes