Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
builtin = clear,rare,en-GB_to_en-US
skip = *.pdf,*.png,*.jpg,*.jpeg,*.gif,*.csv,*.tsv,*.json,*.geojson,*.graphml,*.ipynb,*.html,*.svg,*.bib,*.bbl,*.lock,*.parquet,*.rda,*.rds,*.RData,*.dta,*.xlsx,*.xml,*.min.js,*.map,*.log,*.aux,./data,./tabs
ignore-words-list = analogue,favourable,judgement,neighbouring,pregression
18 changes: 18 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: codespell

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: codespell-project/actions-codespell@e3258cca84ce02b0bb36a3d41f2c18f719a0cc1a # v2.4.3
14 changes: 7 additions & 7 deletions ms/ms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
($SE = \numSEClustered$, clustered by album). Weekday comparisons do not account for the estimated association under the tested specifications: ten Fridays
drawn at random reach the observed effect \numFridayPlaceboDraws{} times in ten thousand, the mean
Friday residual after the paper's fixed effects is a seventh of a death, and a model-free contrast
of each release against its own neighbouring Fridays gives $+\numEffectAdjacentFriday$, a ratio
of each release against its own neighboring Fridays gives $+\numEffectAdjacentFriday$, a ratio
the original authors also report. Applying the estimator to the same calendar positions in other
years returns \numEffectCalendarPlacebo{}.

Expand Down Expand Up @@ -113,7 +113,7 @@ \section{Introduction}
estimated release association under the tested specifications. Ten Fridays drawn at random reach the observed effect \numFridayPlaceboDraws{} times in ten
thousand; the comparison is unchanged by whether weekday fixed effects are in the model at all;
letting the Friday effect vary by season and by year moves the estimate by about a death; a
contrast of each release against its own neighbouring Fridays, which uses no model, recovers a
contrast of each release against its own neighboring Fridays, which uses no model, recovers a
ratio the original authors also report; and applying the estimator to the same calendar positions
in other years returns \numEffectCalendarPlacebo{}. The day $-6$ coefficient that looks like a
pre-trend is a Saturday, and the actual previous Friday is flat.
Expand Down Expand Up @@ -144,7 +144,7 @@ \section{Replication}
The reported and replicated estimates are close. \citeauthor{patel2026smartphones} report $+18.2$
deaths. We estimate $+\numEffectRegression$ deaths ($SE = \numSEClustered$), a
\numPctRegression\% increase on a control-day mean of \numControlMean{} fatalities, which is the
analogue of the 120.9 they report. The point estimates differ by \numDiffFromPaper{} deaths, well
analog of the 120.9 they report. The point estimates differ by \numDiffFromPaper{} deaths, well
within one standard error.

Our wider standard error reflects album-level clustering, which is the natural adjustment when
Expand Down Expand Up @@ -232,15 +232,15 @@ \subsection{Day of Week}
The event study appears at first to say otherwise, with a coefficient of $+16.5$ on day $-6$,
nearly the size of the release-day coefficient. Day $-6$ is not the previous Friday. For nine of
the ten albums it is the Saturday before release. The previous Friday is day $-7$, at $+3.8$
($t = 0.92$), and the following Friday is day $+7$, at $-0.3$. Both same-weekday neighbours are
($t = 0.92$), and the following Friday is day $+7$, at $-0.3$. Both same-weekday neighbors are
quiet, which is the adjacent-Friday contrast read off the event study. A joint test of flatness
across the ten pre-treatment days, flipping the sign of each album's whole residual vector so that
the correlation induced by using the same ten albums for every coefficient is respected, returns
$p = 0.19$; dropping day $-6$ returns $p = 0.70$.

\subsection{Calendar Position}

Labels choose release dates, so the dates are not random. If the choice favours positions that are
Labels choose release dates, so the dates are not random. If the choice favors positions that are
also high-risk, the estimate picks that up. Applying each album's date to every other year in the
series, matched to the nearest same weekday, reproduces the seasonal and holiday context without
the album. Those \numNCalendarPlacebo{} placebo dates average \numEffectCalendarPlacebo{} deaths
Expand Down Expand Up @@ -336,7 +336,7 @@ \subsection{The Mechanism Is Untested}

Applying the estimator to variables that describe the crashes rather than counting them turns up
one result. Mean crash latitude is $+0.37$ degrees on release days ($t = 2.91$). This is not a
placebo failure, because latitude summarises the same crashes whose count is the outcome and is
placebo failure, because latitude summarizes the same crashes whose count is the outcome and is
therefore not independent of treatment. Neither is it demonstrably a composition artifact: if the
extra crashes dragged the mean, albums with the largest excess would show the largest shift, and
the correlation across the ten is \numRLatitudeExcess{} ($p = \numPLatitudeExcess$), with
Expand Down Expand Up @@ -388,7 +388,7 @@ \subsection{The Effect Belongs to the Ten Albums, Not to Releases That Size}
are $\numNDoseMatched$ such albums and they average $\numEffectDoseMatched$ deaths
($SE = \numEffectDoseMatchedSE$, 95\% CI $[\numEffectDoseMatchedLo,
\numEffectDoseMatchedHi]$), against $+\numEffectResidual$ for the ten. The comparison set
is a rule rather than a judgement about which releases were major: reach
is a rule rather than a judgment about which releases were major: reach
$\numDoseCut$ million first-day US streams and you are in it.

Getting to that comparison took two corrections to the paper's dose. The first is that
Expand Down
6 changes: 3 additions & 3 deletions src/s01_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ def load_local_fars(directory="."):
"""
Load FARS Accident CSVs downloaded manually from NHTSA.

Column names are normalised to upper case before concatenation. FARS is
Column names are normalized to upper case before concatenation. FARS is
not consistent about case across vintages: the 2007 file names its
coordinate columns `latitude` and `longitud` while every later file uses
`LATITUDE` and `LONGITUD`. Concatenating without normalising produces two
`LATITUDE` and `LONGITUD`. Concatenating without normalizing produces two
columns for one variable, so `df["LATITUDE"]` returns a DataFrame rather
than a Series and any code doing `{c.upper(): c for c in df.columns}`
silently keeps whichever came last, dropping the other year's values.

The 2021 and 2022 files also carry a UTF-8 byte-order mark, which makes
their first column `\ufeffSTATE` rather than `STATE`. Any lookup by name
misses it, silently, for exactly those two years. Both problems are
normalised away here rather than worked around at each call site.
normalized away here rather than worked around at each call site.
"""
frames = []
for f in sorted(Path(directory).glob("*ccident*.csv")):
Expand Down
2 changes: 1 addition & 1 deletion src/s03_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def _modal_weekday(day_offset):

Nine of the ten releases are Fridays, so day -7 and +7 are Fridays and
day -6 is a Saturday. Naming the weekday in the output stops the event
study from being read as though the neighbouring same-weekday days were
study from being read as though the neighboring same-weekday days were
somewhere else in the window.
"""
names = [
Expand Down
2 changes: 1 addition & 1 deletion src/s05_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def robustness_to_one_day(df_global, albums=None, n_sims=20000, seed=42):
recomputed with the single most influential album removed.

The randomization p-value for the median compares the observed median with
medians of ten days drawn at random, which is the rank analogue of the
medians of ten days drawn at random, which is the rank analog of the
randomization inference run on the mean elsewhere.

Returns DataFrame with one row per statistic.
Expand Down
2 changes: 1 addition & 1 deletion src/s06_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def release_day_weather(accidents, albums=None, window=10):
That second question matters because these shares are computed from the
crashes that happened, not from weather stations. They are a composition
measure of the outcome rather than an exogenous covariate, so conditioning
on them risks controlling for a consequence of treatment. The defence is
on them risks controlling for a consequence of treatment. The defense is
not that the risk is theoretical but that the shares do not move on release
days, which is reported here. A cleaner design would use station weather
weighted by population; this repository does not have it.
Expand Down
8 changes: 4 additions & 4 deletions src/s07_falsification.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def friday_placebo_test(df_global, n_sims=10000, n_pick=10, seed=42):
and ask how often the placebo reaches the observed effect.

Draws are from `resid_global`, which already nets out day-of-week, month, year
and holiday fixed effects, so the null distribution is centred at zero by
and holiday fixed effects, so the null distribution is centered at zero by
construction. That is the point: after the paper's controls there is no Friday
contrast left for a placebo to pick up.

Expand Down Expand Up @@ -657,7 +657,7 @@ def calendar_position_placebo(df_global, albums=None, window=10):
"""
Are these calendar positions dangerous, album or no album?

Labels choose release dates, so the dates are not random. If they favour
Labels choose release dates, so the dates are not random. If they favor
positions that are also high-risk, a holiday weekend or the start of a
travel season, the release-day estimate picks that up. The test applies
each album's calendar position to every other year in the series, matched
Expand Down Expand Up @@ -846,7 +846,7 @@ def adjacent_friday_contrast(daily_df, albums=None, offsets=(-14, -7, 7, 14)):
The random-Friday placebo already answers the day-of-week objection, but it
answers it through a model: the comparison runs on residuals from a fixed
effects fit. This does not. For each Friday release it compares the release
day with the same album's own neighbouring Fridays, so the contrast is held
day with the same album's own neighboring Fridays, so the contrast is held
at the same weekday, the same season and the same year by construction, and
no dummy has to do any absorbing.

Expand All @@ -855,7 +855,7 @@ def adjacent_friday_contrast(daily_df, albums=None, offsets=(-14, -7, 7, 14)):
even though it agrees in magnitude with the fixed-effects estimate. Patel
et al. run the same comparison and report an odds ratio of 1.10.

Donda is excluded: it is the one Sunday release, and it has no neighbouring
Donda is excluded: it is the one Sunday release, and it has no neighboring
Fridays to be compared with.

Returns DataFrame with one row per album and a pooled row.
Expand Down
2 changes: 1 addition & 1 deletion src/s09_magnitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def power_analysis(

# The calculation is only as relevant as the estimator it models, and there
# are three candidate standard errors for one quantity. Running all three
# shows which way the choice cuts: the null SE is the most favourable to
# shows which way the choice cuts: the null SE is the most favorable to
# the published estimate, and it is the one quoted in the text.
se_options = [
("null (residual SD / sqrt n)", se_null),
Expand Down
4 changes: 2 additions & 2 deletions src/s13_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def paper_album_keys(first_day, albums=None):
nine albums the paper never studied, at doses an order of magnitude below
the real ones. The key is lead artist and date together.

Lead artist needs normalising because a joint credit is stored two ways.
Lead artist needs normalizing because a joint credit is stored two ways.
Her Loss is "Drake & 21 Savage" in the album list and "Drake|21 Savage" in
the chart, whose lead is "Drake".
"""
Expand Down Expand Up @@ -281,7 +281,7 @@ def dose_matched_contrast(per_album, first_day, albums=None, years=(2018, 2022))

This is a rule, not a list. Nothing about it depends on which albums anyone
considered major, and the comparison albums are matched on the paper's own
treatment intensity rather than on a judgement about fame.
treatment intensity rather than on a judgment about fame.

The year restriction is reported because the comparison albums run to 2024
while the paper's stop in 2022. It is a check, not the headline: the
Expand Down
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def album_stats(values, alpha=0.05):
"""
Summarise a set of per-album effects.
Summarize a set of per-album effects.

Album-level effects are averages over a handful of treated units, so the
standard error uses the sample standard deviation (ddof=1) and critical
Expand Down
2 changes: 1 addition & 1 deletion tests/test_guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class TestColumnNormalisation:
"""FARS is inconsistent about column case across vintages.

The 2007 file names its coordinates `latitude` and `longitud`; every later
file uses upper case. Concatenating without normalising gives two columns
file uses upper case. Concatenating without normalizing gives two columns
for one variable, so `df["LATITUDE"]` returns a DataFrame and any code
building `{c.upper(): c for c in df.columns}` silently keeps one and drops
the other year's values.
Expand Down
Loading