Skip to main content

Note 32: Ethics, Transparency & Accountability in Time Series Forecasting

Module 7: Wrangling, Case Studies & Ethics

Learning Objectives

  • Demonstrate empirically how silent gap imputation on non-trading calendar days suppresses financial volatility and injects spurious return autocorrelation.
  • Quantify how smoothing-window choices in STL decomposition alter perceived recession timing and magnitude in macroeconomic employment series.
  • Measure temporal aggregation bias by comparing daily versus monthly drawdowns during an acute market shock.
  • Apply a structured 5-stage accountability framework for honest uncertainty communication and transparent reporting in forecasting.

1. Gap Treatment & Silent Imputation Bias

Financial assets trade only on business days, creating natural 2- and 3-day weekend or holiday gaps in calendar time. Treating missing market days as missing data to be linearly interpolated fabricates prices on closed exchanges.

Consider Alphabet (data/google.csv) during Q1 2023 (2023-01-01 to 2023-03-31). Let \(P_t\) denote the closing price and \(r_t = \log(P_t) - \log(P_{t-1})\) the log return. Under an honest trading-day index, consecutive observations measure actual market-to-market price changes. Under silent calendar-day linear interpolation, a Friday-to-Monday jump \(\Delta = P_{\text{Mon}} - P_{\text{Fri}}\) is sliced into three nearly equal daily increments \(\Delta/3\) across Saturday, Sunday, and Monday. Splitting one random shock into three identical consecutive steps simultaneously:

  1. Shrinks the sample return standard deviation (understating investment risk), and
  2. Injects artificial positive autocorrelation at lags 1 and 2 (creating an illusion of return predictability!).
goog <- read_csv("data/google.csv", show_col_types = FALSE) |>
  mutate(Date = as_date(Date)) |>
  arrange(Date)

g23 <- goog |> filter(Date >= as_date("2023-01-01"), Date <= as_date("2023-03-31"))

g23_honest <- g23 |>
  mutate(trading_day = row_number(), log_ret = difference(log(Close))) |>
  as_tsibble(index = trading_day) |>
  filter(!is.na(log_ret))

g23_interp <- g23 |>
  as_tsibble(index = Date) |>
  fill_gaps() |>
  mutate(
    Close_imp = zoo::na.approx(Close, rule = 2),
    is_imputed = is.na(Close),
    log_ret = difference(log(Close_imp))
  ) |>
  filter(!is.na(log_ret))

tibble(
  Treatment = c("Honest trading-day returns", "Linearly interpolated calendar days"),
  Observations = c(nrow(g23_honest), nrow(g23_interp)),
  Return_SD = c(sd(g23_honest$log_ret), sd(g23_interp$log_ret)),
  Lag1_ACF = c(acf(g23_honest$log_ret, plot = FALSE)$acf[2], acf(g23_interp$log_ret, plot = FALSE)$acf[2]),
  Lag2_ACF = c(acf(g23_honest$log_ret, plot = FALSE)$acf[3], acf(g23_interp$log_ret, plot = FALSE)$acf[3])
) |> fmt_tbl(digits = 4, caption = "Impact of silent weekend linear interpolation on Alphabet (GOOG) log returns, Q1 2023.")
Impact of silent weekend linear interpolation on Alphabet (GOOG) log returns, Q1 2023.
Treatment Observations Return_SD Lag1_ACF Lag2_ACF
Honest trading-day returns 61 0.0249 0.0744 -0.0769
Linearly interpolated calendar days 87 0.0201 0.0967 0.0241
p_price <- g23_interp |>
  ggplot(aes(x = Date, y = Close_imp)) +
  geom_line(color = ts_pal["slate"], linewidth = 0.65) +
  geom_point(aes(color = is_imputed), size = 1.6) +
  scale_color_manual(
    values = c(`FALSE` = unname(ts_pal["navy"]), `TRUE` = unname(ts_pal["crimson"])),
    labels = c(`FALSE` = "Observed trading day", `TRUE` = "Imputed weekend/holiday")
  ) +
  labs(title = "Synthetic Weekend Bridges (Q1 2023)", x = "Date", y = "Close (USD)", color = NULL)

p_dist <- bind_rows(
  tibble(Treatment = "Honest trading days", log_ret = g23_honest$log_ret),
  tibble(Treatment = "Weekend interpolated", log_ret = g23_interp$log_ret)
) |>
  ggplot(aes(x = log_ret, fill = Treatment)) +
  geom_density(alpha = 0.45, color = NA) +
  scale_fill_manual(values = c("Honest trading days" = unname(ts_pal["navy"]), "Weekend interpolated" = unname(ts_pal["orange"]))) +
  scale_x_continuous(labels = percent_format(accuracy = 1)) +
  labs(
    title = "Return Dispersion Compression",
    x = TeX(r"(Daily log return, $r_t = \ln(P_t / P_{t-1})$)", bold = TRUE),
    y = "Density",
    fill = NULL
  )

(p_price | p_dist) +
  plot_layout(guides = "collect") &
  theme(legend.position = "bottom")
Figure 1: Alphabet (GOOG) Q1 2023 closing prices with synthetic weekend bridges (left) and resulting compression of log-return dispersion (right).

Even in a single quarter (Figure 1), silent linear interpolation slashes return standard deviation by 19% (0.0249 down to 0.0201) and pushes lag-1 and lag-2 ACF upward. In risk management or Value-at-Risk reporting, undisclosed calendar-day interpolation misleads stakeholders about tail exposure.

2. Smoothing-Window Sensitivity & Policy Narratives

Decomposition parameters are rarely neutral. In STL decomposition (STL(y ~ trend(window = w))), a short local trend window follows business-cycle turning points closely, whereas a wide multi-year window flattens recessions into gentle ripples.

Using U.S. Total Private nonfarm payroll employment (us_employment, 1990–2019), we compare a 13-month trend window against a 121-month (10-year) trend window, zooming into the 2007–2011 Great Recession with patchwork::inset_element().

emp_priv <- us_employment |>
  filter(Title == "Total Private", year(Month) >= 1990)

emp_stl <- emp_priv |>
  model(
    `Short window (13 mo)` = STL(Employed ~ trend(window = 13) + season(window = "periodic")),
    `Long window (121 mo)` = STL(Employed ~ trend(window = 121) + season(window = "periodic"))
  ) |>
  components()

p_main <- ggplot() +
  geom_line(data = emp_priv, aes(x = Month, y = Employed / 1000),
            color = ts_pal["slate"], alpha = 0.45, linewidth = 0.5) +
  geom_line(data = emp_stl, aes(x = Month, y = trend / 1000, color = .model), linewidth = 0.9) +
  scale_color_manual(
    values = c(
      "Short window (13 mo)" = unname(ts_pal["navy"]),
      "Long window (121 mo)" = unname(ts_pal["crimson"])
    ),
    breaks = c("Short window (13 mo)", "Long window (121 mo)")
  ) +
  expand_limits(y = 83) +
  labs(
    title = "How Smoothing Windows Rewrite Recession Severity",
    subtitle = "U.S. Total Private employment (millions): 13-month vs. 121-month STL trend",
    x = "Month", y = "Employment (millions)", color = NULL
  )

p_zoom <- emp_stl |>
  filter(year(Month) >= 2007, year(Month) <= 2011) |>
  ggplot(aes(x = Month, y = trend / 1000, color = .model)) +
  geom_line(linewidth = 0.85) +
  scale_color_manual(values = c(
    "Short window (13 mo)" = unname(ts_pal["navy"]),
    "Long window (121 mo)" = unname(ts_pal["crimson"])
  )) +
  labs(title = "2007–2011 Zoom", x = NULL, y = NULL) +
  theme_ts(base_size = 8.5) +
  theme(
    legend.position = "none",
    plot.margin = margin(5, 12, 4, 5),
    plot.background = element_rect(fill = "white", color = "#CBD5E0", linewidth = 0.5)
  )

p_main + inset_element(p_zoom, left = 0.50, bottom = 0.03, right = 0.99, top = 0.43)
Figure 2: STL trend estimates of U.S. Total Private employment (1990–2019) using 13-month versus 121-month trend windows, with a zoomed inset on the 2007–2011 recession.

In the zoomed recession inset (Figure 2), the 13-month trend accurately dates the employment peak to 2007 Nov (115.9M) and trough to 2010 Jan (107.5M), capturing an 8.4-million-job contraction. The 121-month trend dates the peak six months too early (2007 May), delays the trough seven months (2010 Aug), and shrinks the apparent loss to just 1.1 million jobs. Choosing a smoothing window without sensitivity analysis can silently support opposing economic or policy claims from the exact same dataset.

3. Temporal Aggregation Bias

Aggregating high-frequency observations to monthly averages simplifies charts but erases acute intra-month stress. We compare Alphabet’s daily 2020 peak-to-trough drawdown,

\[D_t = \frac{P_t - \max_{s \le t} P_s}{\max_{s \le t} P_s},\]

against the drawdown computed from monthly mean closing prices across the same calendar year.

g20_daily <- goog |>
  filter(year(Date) == 2020) |>
  mutate(drawdown = (Close - cummax(Close)) / cummax(Close))

g20_monthly <- g20_daily |>
  mutate(Month = floor_date(Date, "month") + days(14)) |>
  group_by(Month) |>
  summarise(Close_avg = mean(Close), .groups = "drop") |>
  mutate(drawdown = (Close_avg - cummax(Close_avg)) / cummax(Close_avg))

ggplot() +
  geom_line(data = g20_daily, aes(x = Date, y = drawdown, color = "Daily close"), linewidth = 0.8) +
  geom_line(data = g20_monthly, aes(x = Month, y = drawdown, color = "Monthly mean"), linewidth = 1.0, linetype = "dashed") +
  geom_point(data = g20_monthly, aes(x = Month, y = drawdown, color = "Monthly mean"), size = 2.0) +
  scale_color_manual(values = c("Daily close" = unname(ts_pal["navy"]), "Monthly mean" = unname(ts_pal["orange"]))) +
  scale_y_continuous(labels = percent_format(accuracy = 1)) +
  labs(
    title = "Temporal Aggregation Bias During the March 2020 Crash",
    subtitle = "Daily drawdown hit -30.8% on Mar 23 vs. -18.8% from monthly averages",
    x = "Date (2020)",
    y = TeX(r"(Peak-to-trough drawdown, $D_t$)", bold = TRUE),
    color = NULL
  )
Figure 3: Daily versus monthly-average closing prices of Alphabet (GOOG) during 2020, showing how monthly aggregation conceals over a third of the March 2020 crash.

In Figure 3, reporting monthly averages hides 12 percentage points of genuine equity loss (-18.8% vs. -30.8%). Whenever extreme thresholds matter (margin calls, hospital bed capacity, grid peak load, flood levels), report high-frequency extremes alongside aggregated trends.

4. Honest Uncertainty Communication & Accountability Checklist

Presenting a single forecast line without calibrated prediction intervals invites false certainty. Forecast variance grows systematically with horizon \(h\) and explodes across structural breaks; showing 80% and 95% intervals communicates the true range of plausible outcomes and reminds stakeholders that point forecasts are conditional expectations, not guarantees.

tibble(
  Stage = c(
    "1. Data Provenance",
    "2. Gap Handling",
    "3. Transformations",
    "4. Sensitivity Analysis",
    "5. Uncertainty & Drift"
  ),
  `Key Ethical Question` = c(
    "Where did the series originate, and what upstream filters or revisions already ran?",
    "Are gaps structural (weekends) or sensor outages, and how does imputation change variance?",
    "How do Box-Cox transforms, seasonal adjustments, or aggregations alter scale and extremes?",
    "Do policy conclusions flip under alternative smoothing windows, holdout splits, or model families?",
    "Are calibrated prediction intervals, out-of-sample errors, and regime-break caveats reported?"
  ),
  `Minimum Disclosure` = c(
    "Source URL/archive date, cadence, unit definitions, and known preprocessing flags.",
    "Exact % imputed, method used, and side-by-side observed vs. imputed diagnostics.",
    "Explicit transform formula, bias-adjustment status, and high-frequency extreme checks.",
    "Comparison table across at least two window/model choices on an out-of-sample split.",
    "80%/95% intervals, holdout RMSE/MASE, and explicit conditions that invalidate the forecast."
  )
) |> fmt_tbl()
Table 1: Five-stage accountability checklist for transparent time series analysis and forecasting.
Stage Key Ethical Question Minimum Disclosure
1. Data Provenance Where did the series originate, and what upstream filters or revisions already ran? Source URL/archive date, cadence, unit definitions, and known preprocessing flags.
2. Gap Handling Are gaps structural (weekends) or sensor outages, and how does imputation change variance? Exact % imputed, method used, and side-by-side observed vs. imputed diagnostics.
3. Transformations How do Box-Cox transforms, seasonal adjustments, or aggregations alter scale and extremes? Explicit transform formula, bias-adjustment status, and high-frequency extreme checks.
4. Sensitivity Analysis Do policy conclusions flip under alternative smoothing windows, holdout splits, or model families? Comparison table across at least two window/model choices on an out-of-sample split.
5. Uncertainty & Drift Are calibrated prediction intervals, out-of-sample errors, and regime-break caveats reported? 80%/95% intervals, holdout RMSE/MASE, and explicit conditions that invalidate the forecast.

Practice Exercises

  1. Full-Sample Weekend Interpolation Artifact. Repeat the Section 1 comparison across all five years of data/google.csv (2019-01-02 to 2023-12-29). Report the return standard deviation and lag-1 ACF for both honest trading-day returns and linearly interpolated calendar-day returns, and compute the percentage reduction in measured volatility.
Solution

Compare the honest sequential trading-day index against the calendar-day fill_gaps() + na.approx() index across 2019–2023:

g_all_honest <- goog |>
  mutate(trading_day = row_number(), log_ret = difference(log(Close))) |>
  filter(!is.na(log_ret))

g_all_interp <- goog |>
  as_tsibble(index = Date) |>
  fill_gaps() |>
  mutate(Close_imp = zoo::na.approx(Close, rule = 2), log_ret = difference(log(Close_imp))) |>
  filter(!is.na(log_ret))

sd_h <- sd(g_all_honest$log_ret)
sd_i <- sd(g_all_interp$log_ret)

tibble(
  Treatment = c("Honest trading days (2019–2023)", "Calendar-day linear interpolation"),
  N = c(nrow(g_all_honest), nrow(g_all_interp)),
  Return_SD = c(sd_h, sd_i),
  SD_Change_Pct = c(0, (sd_i - sd_h) / sd_h * 100),
  Lag1_ACF = c(acf(g_all_honest$log_ret, plot = FALSE)$acf[2], acf(g_all_interp$log_ret, plot = FALSE)$acf[2])
) |> fmt_tbl(digits = 4, caption = "Full-sample volatility suppression and lag-1 ACF shift under weekend interpolation.")
Full-sample volatility suppression and lag-1 ACF shift under weekend interpolation.
Treatment N Return_SD SD_Change_Pct Lag1_ACF
Honest trading days (2019–2023) 1257 0.0201 0.00 -0.0931
Calendar-day linear interpolation 1822 0.0155 -22.87 -0.0160

Weekend linear interpolation reduces measured daily return volatility by 22.9% (0.0201 down to 0.0155) and shifts the lag-1 ACF upward from -0.093 toward -0.016.

  1. STL Window Sensitivity on U.S. Retail Trade. Filter us_employment to Title == "Retail Trade" from 1990 onward, fit STL with trend(window = 13) versus trend(window = 61) (season(window = "periodic")), and compare the estimated peak month, trough month, and peak-to-trough job loss during 2007–2011.
Solution

Extract the 2007–2011 trend components for both windows and summarize turning points:

us_employment |>
  filter(Title == "Retail Trade", year(Month) >= 1990) |>
  model(
    Window_13 = STL(Employed ~ trend(window = 13) + season(window = "periodic")),
    Window_61 = STL(Employed ~ trend(window = 61) + season(window = "periodic"))
  ) |>
  components() |>
  filter(year(Month) >= 2007, year(Month) <= 2011) |>
  as_tibble() |>
  group_by(.model) |>
  summarise(
    Peak_Month = as.character(Month[which.max(trend)]),
    Trough_Month = as.character(Month[which.min(trend)]),
    Peak_Thousands = max(trend),
    Trough_Thousands = min(trend),
    Loss_Thousands = max(trend) - min(trend)
  ) |>
  fmt_tbl(digits = 1, caption = "Sensitivity of 2007–2011 U.S. Retail Trade turning points to STL trend window width.")
Sensitivity of 2007–2011 U.S. Retail Trade turning points to STL trend window width.
.model Peak_Month Trough_Month Peak_Thousands Trough_Thousands Loss_Thousands
Window_13 2007 Nov 2010 Jan 15542 14393 1149
Window_61 2007 Jan 2010 Jun 15398 14580 819

Expanding the STL trend window from 13 to 61 months shifts the apparent recession peak 10 months earlier (2007 Jan vs. 2007 Nov), delays the trough 5 months (2010 Jun vs. 2010 Jan), and understates total job losses by 330,000 workers (819k vs. 1,149k).

Key Takeaways

  • Never silently interpolate across structural non-trading gaps like market weekends; linear bridges artificially compress return volatility (~19–23%) and distort short-lag autocorrelation.
  • Always test sensitivity to smoothing parameters (such as STL trend windows): wide windows can shift turning points by half a year and obscure millions of lost jobs.
  • Temporal aggregation conceals acute risk spikes (monthly averaging masked 12 percentage points of Alphabet’s March 2020 drawdown); pair aggregated summaries with high-frequency extremes.
  • Responsible forecasting requires disclosing provenance, gap methods, transformations, sensitivity checks, and calibrated prediction intervals (Table 1).
Back to top