bayesplain.teach.sequential

bayesplain.teach.sequential(outcomes, step=10, prior='uninformed', level=0.95, label='rate')[source]

Recompute the posterior after each chunk of incoming data.

For the lesson where evidence arrives a bit at a time and the class watches the estimate move and the interval close. Also the cheapest way to make two abstractions concrete at once: that a posterior is a running summary of everything seen so far, and that precision improves like the square root of the sample rather than in proportion to it.

Parameters:
outcomes : array_like

A sequence of 0/1 or boolean outcomes, in the order observed. A boolean pandas column works directly.

step : int, default 10

Chunk size. Ten is a good classroom pace: enough steps to see a trend, few enough to read the table aloud.

prior : str, tuple, or BetaPrior, default 'uninformed'

Prior on the rate, before any data.

level : float, default 0.95

Credible level for the reported intervals.

label : str, default 'rate'

What is being estimated, for printed output.

Returns:

Call .table() or .plot().

Return type:

SequentialUpdate

Examples

>>> import bayesplain as bp
>>> outcomes = [1, 0, 0, 1, 0] * 20
>>> run = bp.teach.sequential(outcomes, step=20)
>>> len(run.posteriors)
5
>>> bool(run.widths[-1] < run.widths[0])
True