flowchart LR
A[Forecasts and consensus<br>with actual history] --> B[Validate the tidy panel]
B --> C[Read strictly before<br>the as-of moment]
C --> D[Consensus anchoring<br>frozen coefficients]
C --> E[Bayesian posterior<br>historical precisions]
D --> F[Estimate and explanation<br>or refusal reason]
E --> F
From a forecast to a defensible estimate
Terminology, purpose, and a guided route through the two methods
A model already predicts a company’s revenue. Analysts publish a consensus for that same period. postforecast asks how those readings should be combined, using only information available at a stated moment.
What can be done
- Inspect a disagreement: Measure a forecast’s gap from consensus and distinguish a new view from an old, stale observation.
- Publish an anchored estimate: Combine that gap with the consensus revision and a customary beat, using a frozen coefficient set.
- Publish a Bayesian posterior: Combine historical growth, a model reading, and consensus using their estimated precisions; inspect the resulting interval.
- Explain a result: Retain its inputs, reading moment, parameter version, contributions or weights, and eligibility reason.
- Decline to publish: Preserve a refusal when required information is missing or a method’s eligibility conditions fail.
The package consumes forecasts. Model training, vendor acquisition, and portfolio backtesting remain in the calling application. The real-data notebook performs its own file reads before passing a data frame to the pure library.
The vocabulary
Describe the data
- Time series: Values indexed through time for an identified quantity. Multiple series can be held together using identifying keys and a time index, as described in Forecasting: Principles and Practice.
- Estimate panel: This project’s name for the collection of forecasts, consensus, and actuals across entities and periods. The exact phrase is a project convention; it is not presented as an established forecasting term.
- Tidy data frame: The representation: a variable per column and an observation per row, following Wickham’s Tidy Data. Here a row holds one source’s value for one subject at one availability time.
- Subject: One entity, target, and period, such as Apple revenue for a fiscal period ending in September. Forecast and consensus must refer to that same subject.
- Target period: The period being estimated.
periodis an opaque label;period_endorders periods. A calendar quarter label need not be a company’s fiscal quarter label. - Availability time:
known_at, the timestamp supplied by the data source. It answers when a value may enter a calculation, separately from its target period. - Vintage: A historical version of information. Real-time databases such as ALFRED preserve changes to observations across vintages. An export’s model vintage is additional provenance: an old
known_atdoes not prove the selected model existed on that date.
Describe the readings
- Forecast: An externally produced estimate, identified by its source name.
- Consensus: The aggregate analyst estimate used as the reference reading.
- Actual: An observed outcome. The first actual present in an export is not necessarily the original reported value if the export starts late or backfills history.
- As-of moment: The explicit cutoff for reading the panel. The default includes observations strictly before it, excluding observations at the cutoff itself.
- Point-in-time anchoring: Selecting each value at that cutoff. This is a data operation shared by both method families.
- Consensus anchoring: The specific method that adjusts consensus using a gap and revision. This is a different use of the word “anchoring”.
Describe the arithmetic
- Gap: Forecast divided by consensus, minus one. A gap of
0.05means 5% above consensus; it is not yet a prediction of the eventual surprise. - Revision: Current consensus divided by its earlier reading, minus one. The anchored method uses a 30-day lookback by default.
- Expected surprise: The anchored method’s predicted fractional deviation from consensus. The anchored level is consensus multiplied by one plus that surprise.
- Growth: A level divided by the previous available actual, minus one. These methods use sequential period growth, not automatically year-on-year growth.
- Prior: The mean and variance of the company’s realised growth history.
- Precision: Inverse uncertainty. Model and consensus precisions use inverse mean squared growth error; a systematic bias therefore counts as error.
- Posterior: The combined growth estimate, converted back to a level.
- Interval: The independent method’s configured Student-t uncertainty band. Its nominal coverage is a modelling choice, not measured calibration on this example.
- Eligibility: Whether a method can publish, together with a reason when it cannot. Missing diagnostics or a refused result must not be silently replaced with zero.
Why the distinction matters
Suppose a forecast for a September period changes in August. Both observations have the same target period, but different availability times. A calculation as of the start of August must use the earlier observation. A September export may contain both observations while still reflecting a model selected in September.
Timestamp discipline protects the calculation; source provenance determines what can be claimed about the history. The walkthrough makes both visible.
Follow the model methodology
- Improve an existing forecast: Place post-processing after an existing model and compare errors with later outcomes.
- Real model walkthrough: Load an ADC export, inspect the timestamps, and compute both methods for one company with explanatory figures.
- Anchoring: Study the small worked example, contributions, parameter versions, and refusal rules.
- Bayesian posterior: Study the smaller teaching interface and the effect of changing each source’s precision.
- Independent Bayesian reference: Follow the complete production-compatible mathematics used by the real-model notebook.
For the input mechanics first, start with the panel and point-in-time reads.