prepare_bayesian_subjects

prepare_bayesian_subjects(
    estimates,
    as_of,
    *,
    forecast_source,
    settings=BAYESIAN_DEFAULTS,
    consensus_source=CONSENSUS_SOURCE,
)

Read the panel as of one moment and attach every history the posterior needs.

The history reads take their minimum observations, winsorisation and bias filter from the same settings the posterior is applied under, so the two cannot disagree.

Parameters

Name Type Description Default
estimates pd.DataFrame Long input panel. required
as_of pd.Timestamp Explicit exclusive UTC reading moment. 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 subject with each source’s value and age, the growth prior, each source’s error variance and, when the bias applies, the consensus bias.

Raises

Name Type Description
PanelError The settings were fitted on data reaching as_of.