bayesplain.teach.GridPosterior¶
-
class bayesplain.teach.GridPosterior(grid, prior, likelihood, unnormalized, posterior, kind=
'discrete', label='rate')[source]¶ Prior, likelihood, and posterior over a grid, with the arithmetic shown.
- Variables:¶
- grid¶
The candidate values considered.
- prior¶
Prior weight on each, normalised.
- likelihood¶
Likelihood of the data at each candidate.
- unnormalized¶
prior * likelihood, before dividing through.- posterior¶
The normalised posterior.
- kind=
'discrete'¶ 'discrete'if the posterior sums to 1,'continuous'if it integrates to 1 over the grid.- label=
'rate'¶ What the grid is a grid of, for printing.
Methods
interval([level])Equal-tailed credible interval from the grid.
mean()Posterior mean.
plot([ax])Draw prior, likelihood, and posterior on shared axes.
table([max_rows])Show the four columns whose arithmetic produces the posterior.
-
plot(ax=
None)[source]¶ Draw prior, likelihood, and posterior on shared axes.
- Parameters:¶
- ax : matplotlib.axes.Axes, optional¶
Axes to draw on. Created if omitted.
- Returns:¶
The axes drawn on.
- Return type:¶