In case you want data
set.seed(100)
hotel <- rep(1,100)
hotel <- unlist(lapply(hotel, function(x) { runif(1,1,5) } ))
NULL Hypothesis :- Hotel rating is greater or equal to 3
ALTERNATE Hypothesis :- Hotel rating is less than 3
t.test(hotel, mu = 3, alternative = 'less')
One Sample t-test
data: hotel
t = 0.76629, df = 99, p-value = 0.7773
alternative hypothesis: true mean is less than 3
95 percent confidence interval:
-Inf 3.254185
sample estimates:
mean of x
3.080266
According to this output I fail to reject NULL Hypothesis in favor of alternate Hypothesis.
Here the t-test is suggesting that data is in favor of hypothesis that hotel rating is >=3
But Suppose In case I reversed My hypothesis NULL Hypothesis :- Hotel rating is less than or equal to 3 Alternative :- Hotel rating is greater than 3
t.test(hotel, mu = 3, alternative = 'greater')
One Sample t-test
data: hotel
t = 0.76629, df = 99, p-value = 0.2227
alternative hypothesis: true mean is greater than 3
95 percent confidence interval:
2.906346 Inf
sample estimates:
mean of x
3.080266
Here again I fail to reject my NULL Hypothesis in favor of Alternate Hypothesis.
Again data is in favor of NULL Hypothesis i.e. hotel rating is <=3
Here I am experiencing two different result just by changing my hypothesis. Please help me to understand why this is happening.Is there anything I am not taking correctly.
Note:- I have checked the normality condition using shapiro-wilk test and outlier using boxplot. All are fine.