Warning

Important: This is the documentation of code no longer in active development. This is the link to the current docs: covid19-inference

Plotting

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

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.get_all_free_RVs_names(model)[source]

Returns the names of all free parameters of the model

Parameters:model (pm.Model instance) –
Returns:list of variable names
covid19_inference.plotting.get_prior_distribution(model, x, varname)[source]

Given a model and variable name, returns the prior distribution evaluated at x. :param model: :type model: pm.Model instance :param x: :type x: list or array :param varname: :type varname: string

Returns:array