diff_diff.load_card_krueger#

diff_diff.load_card_krueger(force_download=False)[source]

Load the Card & Krueger (1994) minimum wage dataset.

This classic dataset examines the effect of New Jersey’s 1992 minimum wage increase on employment in fast-food restaurants, using Pennsylvania as a control group.

The study is a canonical example of the Difference-in-Differences method.

Parameters:

force_download (bool, default=False) – If True, re-download the dataset even if cached.

Returns:

Dataset with columns: - store_id : int - Unique store identifier - state : str - ‘NJ’ (New Jersey, treated) or ‘PA’ (Pennsylvania, control) - chain : str - Fast food chain (‘bk’, ‘kfc’, ‘roys’, ‘wendys’) - emp_pre : float - Full-time equivalent employment before (Feb 1992) - emp_post : float - Full-time equivalent employment after (Nov 1992) - wage_pre : float - Starting wage before - wage_post : float - Starting wage after - treated : int - 1 if NJ, 0 if PA - emp_change : float - Change in employment (emp_post - emp_pre)

Return type:

pd.DataFrame

Notes

The minimum wage in New Jersey increased from $4.25 to $5.05 on April 1, 1992. Pennsylvania’s minimum wage remained at $4.25.

Original finding: No significant negative effect of minimum wage increase on employment (ATT ≈ +2.8 FTE employees).

The canonical survey is incomplete: 12 stores lack emp_pre, 14 lack emp_post, and wage_pre/wage_post are missing for 20 and 21 stores. Drop the missing outcome rows before fitting, as the example below does; estimators reject missing outcomes rather than dropping them silently. The synthetic fallback frame is complete, so code that skips this step will work offline and fail once the canonical source is reachable.

The canonical data are checksum-verified and returned with df.attrs["source"] == "card_krueger_public_data". A download failure falls back to a checksum-valid cache entry when one exists, returning that canonical data; a pin mismatch additionally warns that the upstream file has changed. Only when neither a verified cache entry nor a verified fresh download is available - or when the source fails to parse or validate - does the loader emit one UserWarning containing SYNTHETIC and return df.attrs["source"] == "synthetic_fallback".

References

Card, D., & Krueger, A. B. (1994). Minimum Wages and Employment: A Case Study of the Fast-Food Industry in New Jersey and Pennsylvania. American Economic Review, 84(4), 772-793.

Examples

>>> from diff_diff.datasets import load_card_krueger
>>> from diff_diff import DifferenceInDifferences
>>>
>>> # Load and prepare data
>>> ck = load_card_krueger()
>>> ck_long = ck.melt(
...     id_vars=['store_id', 'state', 'treated'],
...     value_vars=['emp_pre', 'emp_post'],
...     var_name='period', value_name='employment'
... )
>>> ck_long['post'] = (ck_long['period'] == 'emp_post').astype(int)
>>>
>>> # 26 store-waves have no employment reading in the source survey
>>> ck_long = ck_long.dropna(subset=['employment'])
>>>
>>> # Estimate DiD
>>> did = DifferenceInDifferences()
>>> results = did.fit(ck_long, outcome='employment', treatment='treated', post='post')