Data, Clocks, and Transformations
Data, Clocks, and Transformations
The transformation is part of the estimand
Write raw observations as and analysed observations as
The matrix is not preprocessing trivia. It determines the units, timing, and economic meaning of every coefficient that follows.
Finance: from recorded price to investable return
For an adjusted price , the log return is
If , then
Log returns add across time:
Before using this identity, resolve:
- splits and dividends: use a documented total-return or adjusted-price convention;
- non-trading days: calendar time and trading time are not interchangeable;
- bid–ask bounce and asynchronous prices: intraday observations can create mechanical serial dependence;
- currency and timezone: a “daily” return must have a common valuation instant;
- survivorship and delisting: today's constituent list cannot define yesterday's investable universe.
Arithmetic returns compound rather than add:
Confusing sums with compounding is a units error, not a model-choice error.
Economics: levels, growth, gaps, and releases
For a positive level , common targets include:
where for annualised monthly growth and for annualised quarterly growth. Year-over-year growth is instead
These targets answer different questions. Annualising one-period growth rescales the latest pace; year-over-year growth compares levels a year apart and smooths short-run movement.
For macro data, record three dates:
- reference period: the month or quarter being measured;
- release date: when the estimate became public;
- vintage date: which subsequently revised value is stored.
ALFRED preserves historical vintages, and the FRED real-time-period documentation explains why observation dates and real-time dates are separate. A real-time forecast must not use a later revision.
Aggregation is also a matrix
Suppose monthly growth is . Quarterly log growth is obtained by summing non-overlapping blocks:
Stocks and flows aggregate differently:
| Variable | Economic type | Typical quarterly mapping |
|---|---|---|
| end-of-month interest rate | stock | last observation or average, depending on question |
| monthly sales | flow | sum |
| price index | index | average level, then compute change with stated convention |
| log growth | rate of change | sum for exact log change |
There is no universal “convert monthly to quarterly” command.
R laboratory: make the operators visible
Price returns and monthly-to-quarterly aggregation
The three errors should be at machine precision. The important result is not the printed percentage; it is that the differencing and aggregation claims are explicit linear maps.
Worked choice: level, change, or gap?
Suppose the question is “Does the yield curve forecast recession?”
- If the predictor is the ten-year minus three-month yield, the level difference is already an economically defined spread.
- If the outcome is quarterly real GDP growth, use a documented growth convention.
- If the outcome is a recession indicator, the model and loss must respect a binary event.
- Differencing the spread merely because it is persistent changes the question from the curve's shape to the change in its shape.
The transformation should preserve the substantive signal the question names.
Transformation audit
Before estimation, write a one-row data contract for every variable:
| Field | Required statement |
|---|---|
| raw source | provider, series, and access date |
| observation unit | currency, index, percentage points, or return |
| reference clock | calendar, trading, month, quarter |
| availability | release lag and publication timestamp |
| revision | first release, specified vintage, or latest revised |
| transformation | exact formula and order of operations |
| missing values | why absent and how treated |
| target horizon | one period, fixed , or cumulative/overlapping |
Practice
- Show that . What information does differencing remove?
- Replace the quarterly rows of by weights . Which variables would this suit?
- A backtest formed in January uses a GDP value revised in June. Name the failure.
Answers
- Every row contains ; differencing removes a constant level and loses the initial condition.
- A variable whose quarterly concept is an average stock or index, provided that convention matches the source.
- Look-ahead through data revision: the June vintage was outside January's information set.
Three Versions of Time Series
A decision guide to classical statistical, financial, and economic time series, with matched examples and method-selection rules.
Predictive Regressions and Persistent Predictors
Matrix derivations for forecasting regressions, overlapping horizons, persistent predictors, and Newey–West inference.