prepare_bayesian_subjects_each

prepare_bayesian_subjects_each(
    estimates,
    readings,
    *,
    forecast_source,
    settings=BAYESIAN_DEFAULTS,
    consensus_source=CONSENSUS_SOURCE,
)

Prepare Bayesian subjects with one reading moment per row.

Each row equals the row prepare_bayesian_subjects returns for that subject when called at that row’s moment, on every column that call returns. The frame carries a column for every source in the panel, so a source not yet knowable at a row’s moment is missing there rather than absent. A subject with nothing knowable at its moment gets a row with every prepared field missing, which the posterior refuses as missing input.

Parameters

Name Type Description Default
estimates pd.DataFrame Long input panel. required
readings pd.DataFrame One row per subject and moment: the subject columns, period_end and a UTC as_of column. required
forecast_source str The source blended alongside consensus. required
settings BayesianSettings The settings the posterior will be applied under. BAYESIAN_DEFAULTS
consensus_source str The source treated as consensus. CONSENSUS_SOURCE

Returns

Name Type Description
pd.DataFrame One row per reading, in reading order: the subject columns, as_of, each source’s value, known_at, metadata and age, then the growth prior, the error variances and, when the bias applies, the consensus bias.