I have created a T test in R and got the below output.


##  One Sample t-test
## data:  casein
## t = 3.348, df = 11, p-value = 0.003251
## alternative hypothesis: true mean is greater than 261.3099
## 95 percent confidence interval:
##  290.1791      Inf
## sample estimates:
## mean of x 
## 323.5833 

Here as you can see the P-value is 0.003, which is less than the significant value of 0.05. Hence shouldn't the alternative hypothesis be rejected in this case? How is true?

  • $\begingroup$ Where can we find the casein dataset? The question is easier to answer if we can reproduce what you've done. $\endgroup$ – Richie Cotton Aug 28 '16 at 6:32
  • $\begingroup$ Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. $\endgroup$ – Squazz Aug 28 '16 at 7:26

The purpose of the t.test() function is to return the p-value, a confidence interval and a some summary statistics. That is what it has done.

It is up to you do decide what you want do with the results. If you think that p = 0.003 is sufficiently small to reject the null hypothesis, then that is your business.

Note that it is always the null hypothesis (that mu=pw) that is accepted or rejected, not the alternative. The alternative hypothesis (that mu>pw) is, as the name implies, the alternative when the null become untenable.

| cite | improve this answer | |
  • 2
    $\begingroup$ Isn't the null hypothesis mu <= pw, since alternative="greater"? $\endgroup$ – jbaums Aug 28 '16 at 7:16
  • $\begingroup$ The null is never accepted and that is not the right null for this case. $\endgroup$ – Peter Flom Aug 28 '16 at 13:50
  • $\begingroup$ For a one-sided alternative, the null hypothesis could in principle be taken to be the negation (mu <= pw), but most mathematical statisticians, statistics courses and textbooks take the null hypothesis to be equality (mu=pw) regardless of whether a one-sided or two-sided alternative is under consideration. In fact, the p-value and decisions about whether to accept or reject are unaffected by which of the two possible null hypothesis formulations are chosen. $\endgroup$ – Gordon Smyth Aug 29 '16 at 8:07
  • $\begingroup$ There are many circumstances in which a p-value of 0.003 would not lead to rejection, for example when this test is just one of many similar tests being conducted as part of the same study. $\endgroup$ – Gordon Smyth Aug 29 '16 at 8:15

Your null hypothesis is that the true mean is $\le 261.31$. Your alternative hypothesis is given in the output: The true mean is greater than that value.

Given your low p value, you can reject the null hypothesis and conclude that, if, in the population from which your sample was randomly drawn, the true value of the mean was less than or equal to 261.33, it would be very unlikely to get a sample mean of 323.58 in a sample of 12.

| cite | improve this answer | |
  • $\begingroup$ I am not rewriting anything. This is a one sided t test. $\endgroup$ – Peter Flom Sep 3 '16 at 11:41
  • $\begingroup$ Dr Flom, it makes no difference whether it is a one-sided or two-sided test. The null hypothesis still needs to specify the true value of $\mu$, otherwise it is impossible to derive the distribution of the test statistic under the null hypothesis. You advice to the OP is in conflict with statistics textbooks and you should correct it. It would also be more constructive to reply to comments instead of deleting them. $\endgroup$ – Gordon Smyth Sep 4 '16 at 0:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.