08. Time as Data / Event Studies

Data Science for Economists

Irene Iodice

2026-03-01

One vote, two reactions: What happened on March 13?

Event: 13 March 2024 – European Parliament adopts the EU Artificial Intelligence Act.

Google (AI deployer)

Stock rose – less strict regulation than expected?

Nvidia (AI infrastructure)

Stock fell – signal of weaker AI demand ahead?

Why do two companies involved in AI move in opposite directions?

Learn to answer questions like this

How can we tell if an event truly changed something?

  • Would Nvidia’s stock have flattened even without the AI Act?
  • Was Google’s rise part of a positive trend – or is it a specific market signal?
  • When is a price movement just noise – and when is it meaningful?

Our toolkit:

  • Handle and align time-stamped data
  • Use event studies to estimate causal impact
  • Build and test counterfactuals

We start from time. Then move to causality.

Why events in time matter

Why study events in time?

Event data is any data that you want to measure about an event

  • Policy, shocks, news \(\to\) causal impact on markets, firms, outcomes.
  • Requires two lenses: when did it happen and how did series respond.
  • Today: (basic) workflows for time handling & causal inference.

Learning Objectives

  1. Parse, manipulate, and align timestamps in R (lubridate).
  2. Distinguish event, time trend, and outcome.
  3. Execute simple and regression-based event studies.
  4. Know when to pivot to DiD, staggered adoption, or RDD.
  5. Build structural counterfactuals with the gravity model.

Parsing, aligning, and manipulating timestamps

What is a time-stamped datum?

  • Cross-section: values observed once per unit (firm, county, tweet).
  • Time record: each observation carries a timestamp \(\;\Rightarrow\;\) ordering, lags, windows.

\[ \boxed{\;\text{datum} = (\text{ID},\, \textcolor{#e5b567}{t},\, \textcolor{#9e86c8}{\text{attributes}})\;} \]

From now on every method we use must respect this ordering.

Granularity of time

  Year --- Quarter --- Month --- Day --- Hour --- Minute --- Second --- Tick
  |                                                                       |
  coarsest                                                           finest
  • Choose the coarsest frequency that still captures the causal effect.
  • Finer \(\Rightarrow\) more observations, but also noise and dependence.

Date–time objects in R

  • Base R distinguishes Date (days) and POSIXct/POSIXlt (date–times, seconds).
  • The lubridate package (tidyverse) provides a grammar for working with them.
  • Always store timestamps with an explicit time zone – preferably UTC.

Creating date and date–time values

Extracting & modifying components

Spans of time: durations, periods, intervals

Rounding and aligning timestamps

Regular vs. irregular sampling

Equally spaced

Observations at fixed intervals (daily close, monthly GDP).

Irregular / event-driven

Observations arrive at uneven times (trades, tweets, sensor pings).

  • Irregular streams often need resampling.
  • Beware of aggregation bias and missing-data artefacts.

High-frequency data: promises & pitfalls

  • Volume: millions of rows \(\Rightarrow\) storage, speed, and parallel algorithms.
  • Micro-structure noise: bid-ask bounce, timestamp jitter.
  • Simultaneity: many units react within milliseconds.
  • Multiple hypothesis risk: easy to find spurious “events”.

Use HF data only when theory needs sub-daily resolution, and always report how you filtered and aligned the raw feed.

zoo vs. lubridate: Different Tools for Time

zoo (Zeileis, Grothendieck)

  • Time-indexed vectors and matrices
  • Designed for irregular or financial time series
  • Fast rolling stats: rollmean(), rollapply()
  • Plays well with xts, quantmod
  • Base R-style syntax

lubridate (part of tidyverse)

  • Simplifies parsing and modifying Date/POSIX objects
  • Grammar for extracting: year(), month(), wday()
  • Useful for aligning dates, durations, and intervals
  • Integrates naturally with dplyr, ggplot2
  • Ideal for tidy data workflows

Use zoo for time-series math. Use lubridate to parse, clean, and wrangle timestamps.

Isolating causal effects from time series

Event Studies

Event study is probably the oldest and simplest causal inference research design

  • Effect of stock splits on stock prices (Dolley 1933; MacKinlay 1997)
  • The information content of earnings announcements (Ball and Brown 1968)

Fama calls event studies a test of how quickly security prices reflect public information announcements (Fama 1991, p. 1576).

(\(\neq\) Marketing lit: assume market efficiency to measure the value of campaigns, …)

DAGs: Visualising Causal Assumptions

  • DAGs help us visualize assumptions about causal structure.
  • Each arrow encodes a causal relationship between variables.
  • They help identify confounders, mediators, and colliders.
  • Rule: No cycles – a variable cannot cause itself, directly or indirectly.

Treatment \(\longrightarrow\) Outcome

A DAG is a map of our model assumptions – not data.

Confounding and the Back-Door Criterion

  • A back-door path is a non-causal path from Treatment to Outcome that could bias our estimates.
  • To identify the causal effect, we must block all such paths – usually by controlling for confounders.
  • A variable satisfies the back-door criterion if it blocks all back-door paths and is not a collider.

Z

\(\swarrow\) \(\searrow\)

T \(\longrightarrow\) Y

Controlling for Z blocks the confounding path and helps isolate the causal effect.

The impact of COVID-19 on small business

  • Treatment = Pandemic \(\rightarrow\) Outcome = Survival
    • Time series: looking at pre and post pandemics outcome
  • Pandemic \(\leftarrow\) After Event \(\leftarrow\) Time \(\rightarrow\) Outcome
    • All the stuff that changes over time independently of the Pandemic

Financial Fragility of Small Business

Survey to SME: “roughly how much cash (e.g. in savings, checking) do you have access to without seeking further loans or money from family or friends to pay for your business?”

Bartik et al. (2020), The impact of COVID-19 on small business outcomes

Counterfactual Question

Would those firms that went bankrupt, have gone bankrupt even without the pandemic?

  1. Whatever was going on before would have continued doing its thing if not for the treatment
  2. How the actual outcome deviates from that prediction
  3. The extent of the deviation is the effect of treatment

Pre-Trend Analysis

Practical Corner: Boeing bailout

Boeing stock plunges again after coronavirus bailout quest spooks investors

Would this happen even without the bailout? What does the red line tell you?

Check more about the bailout here.

Practical Corner: Getting the data

Practical Corner: Plotting

Event Study Design with Stock Markets: Meta

On February 2nd 2022, Meta (FB) released that its global daily active users declined from the previous quarter for the first time, to 1.929 billion from 1.930 billion.

Event Study Design: Steps

  1. Event Identification:

    • e.g., dividends, M&A, stock buyback, laws or regulation, privatization vs. nationalization, celebrity endorsements, name changes, or brand extensions etc.
    • Events must affect either cash flows or the value of the firm (A. Sorescu, Warren, and Ertekin 2017, 191)
  2. Pick an estimation period

  3. Pick an observation period

Event Study Design: Abnormal Returns

Use the data from the estimation period to estimate a model predicting stock returns in each period:

  1. Mean-adjusted returns model: average in the estimation period \(\hat{R}=\bar{R}\)
  2. Market-adjusted returns model: use the market return in each period \(\hat{R}=R_{M}\)
  3. Risk-adjusted returns model: relation in the estimation period between returns

\[R = \alpha + \beta R_{M} + \epsilon \qquad \hat{R} = E[R \mid R_{M}]\]

  • Calculate abnormal return \(AR = R - \hat{R}\)
  • Is AR constant during the observation period?

Code: Estimation and observation data

Code: Computing abnormal returns

Meta returns around the announcement

Meta (FB) global daily active users declined from the previous quarter for the first time, to 1.929 billion from 1.930 billion.

Why is the Abnormal Return so Short-lived?

What we observe: META’s stock dropped sharply after Feb 2, 2022 – but the abnormal return lasted only 1–2 days.

Why? Efficient Markets Digest News Quickly

  • Prices adjust immediately when new public information arrives.
  • The drop reflects a one-time surprise (decline in active users).
  • After the shock, returns revert to normal levels.

Key idea: Abnormal return captures the difference from expected return, not the full price level.

  • The price may stay low.
  • But the “shock” only happens once – when the news hits.

Abnormal return is short-lived because markets are fast. No new surprise, no new abnormal return.

Modelling long-lasting effects

\[ Y_t = \beta_0 + \beta_1 t + \beta_2 \text{After}_t + \beta_3 (t \times \text{After}_t) + \varepsilon_t \]

  • \(\beta_1\): pre-event trend.
  • \(\beta_2\): one-time jump.
  • \(\beta_3\): change in slope \(\Rightarrow\) persistent effect.

When to use it? Any intervention that keeps working over time: regulations, infrastructure, training programmes.

Serial correlation is inevitable – report HAC/Newey-West SEs.

Case study: UK ambulance quality-of-care policy

Policy introduced mid-2010 to improve pre-hospital care for heart attack / stroke.