consensus_bias

consensus_bias(
    estimates,
    as_of,
    *,
    process_noise=defaults.CONSENSUS_BIAS_PROCESS_NOISE,
    measurement_noise=defaults.CONSENSUS_BIAS_MEASUREMENT_NOISE,
    source=CONSENSUS_SOURCE,
)

Estimate each entity’s persistent consensus error from its own history.

A period’s relative error compares the consensus that stood strictly before that period’s actual became knowable with the actual. A local-level filter runs over those errors oldest first, and each subject reads the filtered state after the latest realised period strictly before its own period_end.

Parameters

Name Type Description Default
estimates pd.DataFrame Long input panel. required
as_of pd.Timestamp The moment to read the panel at. required
process_noise float Nonnegative process variance of the filter. defaults.CONSENSUS_BIAS_PROCESS_NOISE
measurement_noise float Positive measurement variance of the filter. defaults.CONSENSUS_BIAS_MEASUREMENT_NOISE
source str The source whose bias is estimated. CONSENSUS_SOURCE

Returns

Name Type Description
pd.DataFrame One row per subject present in the panel as of as_of, carrying consensus_bias, as a fraction of the actual with positive meaning consensus too high, and consensus_bias_count, the errors behind it. The bias is NaN before the first error; the count is always the true one. A filter variance out of range raises PanelError.