Hypothesis Testing in R
Richie Cotton
Data Evangelist at DataCamp
$H_{0}$: The mean compensation (in USD) is the same for those that coded first as a child and those that coded first as an adult.
$H_{A}$: The mean compensation (in USD) is greater for those that coded first as a child compared to those that coded first as an adult.
Use a right-tailed test.
$\alpha = 0.1$
If $p \le \alpha$ then reject $H_{0}$.
p_value <- pnorm(z_score, lower.tail = FALSE)
numerator <- xbar_child - xbar_adult
denominator <- sqrt(s_child ^ 2 / n_child + s_adult ^ 2 / n_adult)
t_stat <- numerator / denominator
2.4046
degrees_of_freedom <- n_child + n_adult - 2
2578
p_value <- pt(t_stat, df = degrees_of_freedom, lower.tail = FALSE)
0.008130
Hypothesis Testing in R