How do I measure abnormal returns around an event?

Count trading days relative to an event in a long pandas panel, estimate a market model on the days before it, and compute abnormal and cumulative abnormal returns with a benchmark that leaves out the event stock.

After this lesson, you can measure how much a stock’s returns around an event differ from its normal returns, day by day and in total.

How do I count trading days relative to the event?

The event day is day 0, the trading day before it day −1 and the one after it day 1, so a weekend counts as no days. AAA announces its earnings before the open on Monday 10 March 2025, so Friday 7 March is day −1.

The example is a long panel, as in the lesson on long and wide panels, of three made-up stocks over nine trading days, with daily returns in percent. AAA’s benchmark is the mean return of BBB and CCC, which leaves out AAA, so that AAA’s own event does not move it.

panel["ticker"] != "AAA" keeps the other stocks, and .groupby("date").mean() gives the benchmark of each date. .map(market_return) puts each date’s benchmark on AAA’s rows. AAA’s rows are in date order, so its day is the row position minus the number of rows before the event, which (aaa["date"] < "2025-03-10").sum() counts.

The following box builds the panel and counts AAA’s relative days.

import numpy as np
import pandas as pd
import statsmodels.formula.api as smf

dates = pd.bdate_range("2025-02-28", periods=9)

panel = pd.DataFrame({
    "date": np.tile(dates, 3),
    "ticker": np.repeat(["AAA", "BBB", "CCC"], 9),
    "stock_return": [-2.1, -1.2, 0.4, 1.2, 2.7, 1.9, 5.8, -0.5, 2.2,
                     -2.5, -1.5, 0.5, 1.5, 2.5, 1.5, 1.0, -1.5, 2.0,
                     -1.5, -0.5, -0.5, 0.5, 1.5, 0.5, 0.0, -0.5, 1.0],
})
market_return = panel[panel["ticker"] != "AAA"].groupby("date")["stock_return"].mean()

aaa = panel[panel["ticker"] == "AAA"].copy()
aaa["market_return"] = aaa["date"].map(market_return)
aaa["day"] = np.arange(len(aaa)) - (aaa["date"] < "2025-03-10").sum()
print(aaa)
        date ticker  stock_return  market_return  day
0 2025-02-28    AAA          -2.1           -2.0   -6
1 2025-03-03    AAA          -1.2           -1.0   -5
2 2025-03-04    AAA           0.4            0.0   -4
3 2025-03-05    AAA           1.2            1.0   -3
4 2025-03-06    AAA           2.7            2.0   -2
5 2025-03-07    AAA           1.9            1.0   -1
6 2025-03-10    AAA           5.8            0.5    0
7 2025-03-11    AAA          -0.5           -1.0    1
8 2025-03-12    AAA           2.2            1.5    2

On 10 March, the benchmark returns 0.5%, while AAA returns 5.8%.

How do I compute the abnormal returns?

A market model estimated on the days before the event gives AAA’s expected return, and the abnormal return is the actual return minus the expected one. Estimated on days −6 to −2, the model is \(0.2 + 1.2\,R_{m,t}\), so on the event day AAA’s expected return is \(0.2 + 1.2 \times 0.5 = 0.8\%\) and its abnormal return 5.0 percentage points.

\[ AR_t = R_t - (\hat\alpha + \hat\beta\,R_{m,t}), \qquad CAR_{[a,b]} = \sum_{t=a}^{b} AR_t \]

Here \(R_t\) is AAA’s return on day \(t\), \(R_{m,t}\) the benchmark’s, \(\hat\alpha\) and \(\hat\beta\) the estimates from the days before the event, and \(CAR_{[a,b]}\) the cumulative abnormal return from day \(a\) to day \(b\).

abnormal_returns fits the market model on the estimation days, as in the lesson on OLS, and predicts the event days, as in the lesson on predicting with OLS. .between(*estimation_days) keeps the days from the first to the last number of the pair, both included, and .cumsum() adds up the abnormal returns.

The following box computes AAA’s abnormal returns on days −1 to 1.

def abnormal_returns(stock, estimation_days=(-6, -2), event_days=(-1, 1)):
    model = smf.ols("stock_return ~ market_return", data=stock[stock["day"].between(*estimation_days)]).fit()
    event = stock[stock["day"].between(*event_days)].copy()
    event["expected_return"] = model.predict(event)
    event["abnormal_return"] = event["stock_return"] - event["expected_return"]
    event["cumulative_abnormal_return"] = event["abnormal_return"].cumsum()
    return event[["date", "day", "stock_return", "expected_return", "abnormal_return", "cumulative_abnormal_return"]]

print(abnormal_returns(aaa).round(3).to_string())
        date  day  stock_return  expected_return  abnormal_return  cumulative_abnormal_return
5 2025-03-07   -1           1.9              1.4              0.5                         0.5
6 2025-03-10    0           5.8              0.8              5.0                         5.5
7 2025-03-11    1          -0.5             -1.0              0.5                         6.0

The cumulative abnormal return over days −1 to 1 is 6.0 percentage points. Five estimation days show the method, and research uses 120 or more.

Your turn

Compute the abnormal returns on days 0 and 1 only. You should see a cumulative abnormal return of 5.5 percentage points on day 1.

event_days=(0, 1) starts the event window on the event day.

print(abnormal_returns(aaa, event_days=(0, 1)).round(3).to_string())
        date  day  stock_return  expected_return  abnormal_return  cumulative_abnormal_return
6 2025-03-10    0           5.8              0.8              5.0                         5.0
7 2025-03-11    1          -0.5             -1.0              0.5                         5.5