library(AER)
data(CPS1985)
dummy_mod <- lm(wage ~ gender, data = CPS1985)
# test whether the gender gap is significantly different from zero
# use robust standard errors
coeftest(dummy_mod, vcov. = vcovHC, type = "HC0")
# or
linearHypothesis(dummy_mod, "genderfemale=0", vcov. = vcovHC, type = "HC0")
test_predefined_objects("dummy_mod")
test_or({
test_function("coeftest", args = c("x", "vcov."))
},{
test_function("linearHypothesis", args = c("model", "vcov.", "hypothesis.matrix"))
},{
test_function("linearHypothesis", args = c("model", "hypothesis.matrix", "type"))
})
success_msg("Right! The hypothesis that there is no wage gap is rejected at any common level.")