Hypothesis Testing (Critical Value Approach)
Hypothesis Testing (P-Value Approach)
If test statistic < critical value: Fail to reject the null hypothesis.
If test statistic >= critical value: Reject the null hypothesis.
p- values
If p-value <= alpha: Reject the null hypothesis (i.e. significant result).
If p-value > alpha: Fail to reject the null hypothesis (i.e. not signifiant result).
Statistical test rejection statement is in terms of the dichotomy of rejecting and fail to rejecting the null hypothesis.
Rejecting the null hypothesis means that there is sufficient statistical evidence that the null hypothesis does not look likely.
Fail to reject the null hypothesis, as in, there is insufficient statistical evidence to reject it.
HOW TO DEFINE A NULL HYPOTHESIS:
(That is, the population mean is 5 minutes.)
HOW TO DEFINE AN ALTERNATIVE HYPOTHESIS
if you want to test whether the hotel is correct in claiming its average waiting time to get an ordered item five minutes and it it doesn’t matter whether the actual average time is more or less than that, you use the not-equal-to alternative. Your hypotheses for that test would be
If you only want to see whether the time turns out to be greater than what the hotel claim (that is, whether the company is falsely advertising its quick prep time), you use the greater-than alternative, and your two hypotheses are
If you think the average waiting time for an ordered item can be in less than five minutes (and could be marketed by the hotel as such). The less-than alternative is the one you want, and your two hypotheses would be
install.packages("ISLR",repos="https://cran.r-project.org")
library(ISLR)
Warning message: "package 'ISLR' was built under R version 3.4.3"
dim(Wage)
?Wage
try(data(package="ISLR"))
head(Wage)
year | age | maritl | race | education | region | jobclass | health | health_ins | logwage | wage | |
---|---|---|---|---|---|---|---|---|---|---|---|
231655 | 2006 | 18 | 1. Never Married | 1. White | 1. < HS Grad | 2. Middle Atlantic | 1. Industrial | 1. <=Good | 2. No | 4.318063 | 75.04315 |
86582 | 2004 | 24 | 1. Never Married | 1. White | 4. College Grad | 2. Middle Atlantic | 2. Information | 2. >=Very Good | 2. No | 4.255273 | 70.47602 |
161300 | 2003 | 45 | 2. Married | 1. White | 3. Some College | 2. Middle Atlantic | 1. Industrial | 1. <=Good | 1. Yes | 4.875061 | 130.98218 |
155159 | 2003 | 43 | 2. Married | 3. Asian | 4. College Grad | 2. Middle Atlantic | 2. Information | 2. >=Very Good | 1. Yes | 5.041393 | 154.68529 |
11443 | 2005 | 50 | 4. Divorced | 1. White | 2. HS Grad | 2. Middle Atlantic | 2. Information | 1. <=Good | 1. Yes | 4.318063 | 75.04315 |
376662 | 2008 | 54 | 2. Married | 1. White | 4. College Grad | 2. Middle Atlantic | 2. Information | 2. >=Very Good | 1. Yes | 4.845098 | 127.11574 |
# test the hypothesis whether the average wage of male workers in the Mid-Atlantic region is greater than or equal to 50, 5500
t.test(Wage$wage,alternative = "less", mu = 250.7036)
options(scipen = 999)
One Sample t-test data: Wage$wage t = -182.45, df = 2999, p-value < 2.2e-16 alternative hypothesis: true mean is less than 250.7036 95 percent confidence interval: -Inf 112.9571 sample estimates: mean of x 111.7036