library(foreign)
library(dplyr)
data_URL <- "https://github.com/mca91/EconometricsWithR/blob/master/data/fastfood.dta?raw=true"
dat <- read.dta(data_URL)
dat <- dat %>%
mutate(FTE = nmgrs + empft + (0.5 * emppt),
FTE2 = nmgrs2 + empft2 + (0.5 * emppt2))
dat_NJ <- subset(dat, state == 1)
dat_PA <- subset(dat, state == 0)
# test if the difference in mean employment in New Jersey is zero before and after the wage increase
# test if the difference in mean employment in New Jersey is zero before and after the wage increase
t.test(dat_NJ$FTE, dat_NJ$FTE2)
ex() %>% check_predefined_objects(c("dat", "dat_NJ", "dat_PA"))
ex() %>% check_or(
ex() %>% check_function("t.test") %>% check_result() %>% check_equal(),
override_solution(., "t.test(dat_NJ$FTE2, dat_NJ$FTE)") %>% check_function("t.test") %>% check_result() %>% check_equal(incorrect_msg = "Your call of `t.test()` is not correct."))
success_msg(msg = "Corect! Since the p-value is 0.4191 we cannot reject the null hypothesis that there is no differnce in average employment in New Jersey before and after the minimum wage increase.")