# Single Sample t-test Hypothesis Confusion

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.

• Why do statisticians say a non-significant result means “you can't reject the null” as opposed to accepting the null hypothesis?. There's no contradiction in failing to have found much evidence either that the mean is less than 3 or that it's greater than 3; given that we know it's equal to 3 for your simulated data it shouldn't even be at all surprising. (BTW there's not much sense in testing data for normality when you know they come from a uniform distribution. But check your test again - it should be apparent with this sample size.) – Scortchi Jun 13 '16 at 10:51
• @Scortchi thanks a lot. it is really helpful.But it will be more beneficial if you give me certain link of discussing similar approach. – learner Jun 13 '16 at 11:41
• I don't get what you mean there. – Scortchi Jun 13 '16 at 12:05