t.test()in R may be used. This is a rather simple function which performs both one- and two-sample t-tests (it is thus likely that we will meet that function elsewhere in bioST@TS).
data, the command to use is
t.test(data, alternative="XXX", mu = Y)where:
- “XXX” shall be replaced by “greater” OR “less” OR “two.sided” depending of your alternative hypothesis Ha. The null hypothesis H0 states that the sample mean is NOT different from the population mean. Your alternative hypothesis Ha is one of the following:
- the sample mean is greater than the population mean >> use “greater”
- the sample mean is less than the population mean >> use “less”
- the sample mean is either smaller or greater than the population mean >> use “two.sided”.
- Y shall be replaced by the value of the population mean.
R returns several lines of text. One of them provides a p-value while the next line states the alternative hypothesis which depends on the parameter alternative=”XXX” that you have entered in the
t.test(). This alternative hypothesis Ha is considered valid when the p-value is less than 0.05.