bayesplain.Prediction¶
-
class bayesplain.Prediction(*, what, dist, plug_in=
None, frequentist_interval=None, frequentist_method='', unit='', decimals=0, discrete=False, transform=None, inverse=None)[source]¶ A forecast of the next observation, with the parameter uncertainty in it.
What
Result.predict()returns. The posterior answers “what is the rate?”; this answers “what will next year’s count be?”, which is the question a budget or a staffing plan actually turns on. It averages the ordinary sampling variation over every value of the parameter the posterior still allows, so it is always wider than the interval you would get by plugging in a single best estimate – and the gap between the two is exactly the uncertainty the plug-in pretends away.- Parameters:¶
- what : str¶
What is being forecast, e.g.
"successes in the next 100 cases".- dist : scipy frozen distribution¶
The posterior predictive distribution, discrete or continuous.
- plug_in : scipy frozen distribution, optional¶
The same forecast with the parameter fixed at its best estimate.
- frequentist_interval : tuple of float, optional¶
The textbook frequentist prediction interval, where one exists.
- frequentist_method : str¶
What that interval is called.
- unit : str¶
Display unit.
- decimals : int, default 0¶
Decimal places for display. Counts use 0.
- discrete : bool, default False¶
Whether the forecast is a count.
- transform : callable, optional¶
A monotone increasing map applied to the draws of
distand its inverse, for forecasts computed on a log scale and reported on the original one. Quantiles and tail probabilities survive a monotone map exactly, so nothing is approximated.- inverse : callable, optional¶
A monotone increasing map applied to the draws of
distand its inverse, for forecasts computed on a log scale and reported on the original one. Quantiles and tail probabilities survive a monotone map exactly, so nothing is approximated.
Methods
interval([level])Equal-tailed forecast interval.
point()Median of the forecast.
probability([op, value])Probability the next observation satisfies a comparison.
summary([level])Report the forecast next to the plug-in forecast it improves on.