A time series records observations for one subject in temporal order, such as daily views of a single film. Unlike cross-sectional data, which compares many subjects at one moment, it follows change through time. section 11.1
Time indexing also clarifies causal processes. A store’s price may affect demand today, while demand influences the next price decision; writing Pₜ → Dₜ → Pₜ₊₁ replaces an apparently cyclic relationship with events ordered across periods. section 3.2.2
Time series support several causal-inference strategies:
- Use regression discontinuity designs when the event is sudden and no other major factor changes at the same time. section 11.8
- Use synthetic controls when the outcome series correlates with unaffected comparison series, allowing a predictive model to estimate the counterfactual path. section 11.8 section 11.3
- Distinguish time series from panel data, which tracks multiple elements over time and supports difference-in-differences analyses. section 11.1 section 11.8
Estimating the effect of a movie release
Track daily interest in film III before and after film VII launches. Train a model on pre-release III and Lord of the Rings series, then forecast post-release III using the comparison series. The forecast represents interest without the release; the difference from observed interest estimates the release effect. section 11.3
Listing 11.12 (R) Creating Y and correlated time series X1, X2
library(ggplot2) library(CausalImpact) set.seed(1234) periods_n <- 15 impact <- 1000 time_points <- seq(-periods_n, periods_n) n <- length(time_points) seasonality <- -cos(time_points/(2*pi)) D <- as.numeric(time_points >= 0) Y_0 <- 500 + 100*seasonality + rnorm(n, sd=50) Y_1 <- Y_0 + impact * D / (abs(time_points) + 1) Y <- D*Y_1 + (1-D)*Y_0 X_1 <- 400 + 100*seasonality + rnorm(n, sd=20) X_2 <- 700 + 80*seasonality + rnorm(n, sd=60) df <- data.frame(Y, X_1, X_2, time=time_points)
Inspect executable R and Python code that simulates an affected series Y, correlated unaffected series X1 and X2, seasonality, noise, and an event-time treatment. section 11.3.1








