Reference
Public API, data contracts and mathematical definitions
Public entry points
Import the supported API from postforecast.
- publish_anchored: Accepts the estimate panel and
as_of, with requiredforecast_sourceandparameters. Optionalconsensus_source,subjectsandfieldscontrol source selection, the requested universe and numeric outputs. - AnchoringParameters: Frozen, versioned coefficients and eligibility limits. Includes
fitted_through; publication requires it to precede the reading date. - bayesian_kpi_predictions: Accepts the estimate panel and
as_of, with requiredforecast_sourceandsettings. Optionalbacktest_sourceseparates historical model estimates;publicationssupplies publication-relative reading dates. - BayesianPredictionSettings: Frozen configuration for the complete reference workflow.
versionis required. Defaults tomethod="independent",series="combined"andvalues=("prediction",). - BayesianPosterior: The earlier prepared-subject tutorial interface, configured with
BayesianSettings. It remains supported; its behavior is distinguished from the complete workflow in the coverage audit. - prepare_anchored_subjects: Prepares the anchored method’s input, including age and revision data, from the raw panel.
- AnchoredEstimate: Applies versioned parameters to prepared subjects through the
fit/applyprotocol.
Runnable calls are in the how-to guides.
Data contracts
- Estimate panel: One row per subject, source and
known_at. A subject is identified byentity,periodandtarget. The complete column contract includesperiod_end,valueand optional consensus dispersion and contributor count. - Timestamps:
known_at,period_endandas_ofmust be UTC-aware. The caller converts from the known source timezone before passing the frame. - Source names:
actualandconsensushave defined roles. Other source identifiers belong to the caller. - Validation:
validate_estimatesreturns a validated, canonically ordered panel. Invalid input raisesPanelError. - Anchoring:
latest_beforeselects observations strictly before the explicit reading moment by default.age_atmeasures their age. - Reshaping:
pivot_sourcesproduces one row per subject with source value and knowledge-time columns. Colliding generated column names are rejected. - History:
consensus_revision,growth_priorandgrowth_error_varianceprovide the history statistics consumed by the methods. - Method protocol:
fitreturns a frozen fitted object;applydoes not learn. The anchored method validates already-fitted parameters without estimating weights.
Publication results
- Anchored identity: One row per subject, reading moment, forecast source, method and parameter version. Reading policy and fitted-through date accompany it.
- Anchored values:
expected_surpriseis a fraction.anchored_levelis a level. Selected contributions attribute the expected surprise to its ingredients. - Anchored refusals:
eligible=False, missing numeric fields and aneligibility_reason; source levels are never included. - Bayesian identity: Subject keys and period end accompany
as_of,method,settings_versionand resolvedrelative_days. - Bayesian values: Requested reference names are preserved, including hyphens. Growth outputs are fractions;
consensus-bias-pctuses percentage points. - Bayesian refusals:
eligibleandeligibility_reasondescribe prediction availability. Diagnostics can remain available on refused rows.
Mathematical reference
- Independent Bayesian regularization: Growth coordinates, prior moments, error precision, dispersion/count weighting, bias correction, intervals, output names and publication-relative reads.
- Correlation-adjusted Bayesian regularization: Joint sample, Gaussian conditioning, historical and forward fitting, restrictions and numerical limits.
- Anchored estimate: The worked formula and its per-ingredient attribution in the original tutorial.
Provenance and coverage
- Bayesian reference audit: Source snapshot, calculation mapping, golden-scenario evidence and integration boundaries.
- Tutorial provenance: Origins of both method families and the role of reference self-checks as golden tests.