Introduction

Does raising the minimum wage reduce employment? Card and Krueger (1994) used New Jersey’s 1992 minimum-wage increase as a natural experiment, surveying fast-food restaurants in NJ and neighbouring Pennsylvania before and after the rise. Because PA had no change, it serves as a control: the difference-in-differences (DiD) estimate is the change in NJ employment minus the change in PA. This assumes both states would have followed parallel trends without the policy. Below I replicate their main estimate in R, with full-time-equivalent employment as the outcome.

1. The Data from Card & Krueger (1994)

library(dplyr)

library(foreign)
data_URL <- "https://github.com/mca91/EconometricsWithR/blob/master/data/fastfood.dta?raw=true"
dat <- read.dta(data_URL)
head(dat)
dat <- dat %>% mutate(fte = empft + nmgrs + 0.5 * emppt)
summary(dat$fte)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.     NAs 
##    5.00   14.56   19.50   21.00   24.50   85.00      12
names(dat)
##  [1] "sheet"    "chain"    "co_owned" "state"    "southj"   "centralj"
##  [7] "northj"   "pa1"      "pa2"      "shore"    "ncalls"   "empft"   
## [13] "emppt"    "nmgrs"    "wage_st"  "inctime"  "firstinc" "bonus"   
## [19] "pctaff"   "meals"    "open"     "hrsopen"  "psoda"    "pfry"    
## [25] "pentree"  "nregs"    "nregs11"  "type2"    "status2"  "date2"   
## [31] "ncalls2"  "empft2"   "emppt2"   "nmgrs2"   "wage_st2" "inctime2"
## [37] "firstin2" "special2" "meals2"   "open2r"   "hrsopen2" "psoda2"  
## [43] "pfry2"    "pentree2" "nregs2"   "nregs112" "fte"
dat <- dat %>% mutate(fte2 = empft2 + nmgrs2 + 0.5 * emppt2)
summary(dat$fte2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.     NAs 
##    0.00   14.50   20.50   21.05   26.50   60.50      14
  1. State Specific Estimates of Full-Time Employment — I
dat %>%
  group_by(state) %>%
  summarise(before = mean(fte, na.rm = TRUE),
            after  = mean(fte2, na.rm = TRUE))
dat_NJ <- dat %>% filter(state == 1)
dat_PA <- dat %>% filter(state == 0)
mean(dat_NJ$fte,  na.rm = TRUE)   # NJ before
## [1] 20.43941
mean(dat_NJ$fte2, na.rm = TRUE)   # NJ after
## [1] 21.02743
mean(dat_PA$fte,  na.rm = TRUE)   # PA before
## [1] 23.33117
mean(dat_PA$fte2, na.rm = TRUE)   # PA after
## [1] 21.16558
  1. State Specific Estimates of Full-Time Employment — II
t.test(dat_NJ$fte, dat_PA$fte)
## 
##  Welch Two Sample t-test
## 
## data:  dat_NJ$fte and dat_PA$fte
## t = -2.0032, df = 98.562, p-value = 0.0479
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -5.75630044 -0.02722102
## sample estimates:
## mean of x mean of y 
##  20.43941  23.33117
t.test(dat_NJ$fte2, dat_PA$fte2)
## 
##  Welch Two Sample t-test
## 
## data:  dat_NJ$fte2 and dat_PA$fte2
## t = -0.12825, df = 126.49, p-value = 0.8982
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2.269848  1.993538
## sample estimates:
## mean of x mean of y 
##  21.02743  21.16558
  1. Preparing the Data for Regression
reg_dat <- data.frame(
  rbind(
    data.frame(id = dat$sheet, 
               chain = dat$chain,
               state = dat$state,
               empl = dat$fte,
               D = 0),
    data.frame(id = dat$sheet,
               chain = dat$chain,
               state = dat$state,
               empl = dat$fte2,
               D = 1)))
  1. A Difference Estimate using Data from Card & Krueger (1994)
emp_mod <- lm(empl ~ D, data = reg_dat, subset = state == 1)
library(AER)
coeftest(emp_mod, vcov. = vcovHC, type = "HC1")
## 
## t test of coefficients:
## 
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 20.43941    0.50826 40.2142   <2e-16 ***
## D            0.58802    0.72736  0.8084   0.4191    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. A Difference Estimate using Data from Card & Krueger (1994) — II
t_test <- t.test(dat_NJ$fte, dat_NJ$fte2, var.equal = F)
emp_mod <- lm(empl ~ D, data = reg_dat, subset = state == 1)
emp_mod$coef[2]
##         D 
## 0.5880214
diff(t_test$estimate)
## mean of y 
## 0.5880214
t_test$statistic
##          t 
## -0.8084337
coeftest(emp_mod, vcov. = vcovHC, type = "HC1")[2,3]
## [1] 0.8084338
  1. A Difference-in-Differences Estimate — II
emp_did_mod <- lm(empl ~ D*state, data = reg_dat)
coeftest(emp_did_mod, vcov. = vcovHC, type = "HC1")
## 
## t test of coefficients:
## 
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  23.3312     1.3457 17.3370  < 2e-16 ***
## D            -2.1656     1.6412 -1.3195  0.18738    
## state        -2.8918     1.4387 -2.0100  0.04477 *  
## D:state       2.7536     1.7955  1.5337  0.12551    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The DiD estimate (D:state) is 2.75 FTE, SE 1.80, p = 0.13: NJ employment did not fall relative to PA after the wage rise — if anything it rose — matching Card and Krueger’s result. The design identifies a causal effect only if NJ and PA would have moved in parallel absent the policy; with one pre- and one post-period this cannot be tested directly, and the result covers one sector in one state. The same logic applies to evaluating wellbeing interventions: comparing changes in subjective wellbeing where a cash-transfer or psychotherapy programme was rolled out against similar areas without it.

https://www.econometrics-with-r.org/13.5-exercises-13.html - Source of exercise and data