# test that union workers earn the same as non-union workers
cps$union <- as.numeric(cps$unionstatus == "Union")
model <- lm(earnwk ~ union, data = cps)
gamma_hat <- coef(model)
var_gamma_hat <- vcov(model)
wald_test(gamma_hat, var_gamma_hat, R = c(0, 1))
# test that non-union workers make 900/week
# *and* union workers make 1000/week
wald_test(
gamma_hat,
var_gamma_hat,
R = matrix(c(0, 1, 1, 1), nrow = 2),
c = c(900, 1000)
)
Run the code above in your browser using DataLab