Default command line for 2 samples T-test
t.test(x, y, alternative = "two.sided", var.equal = FALSE)
x,y: numeric vectors
alternative: the alternative hypothesis. Allowed value is one of
“two.sided” (default), “greater” or “less”.
var.equal: a logical variable indicating whether to treat the two
variances as being equal. If TRUE then the pooled variance is used to
estimate the variance otherwise the Welch test is used.
Example: A postgraduate students would like to investigate
if there is difference in the mean number of leaves
per plant from two different Shorea species grown under
same light intensity. She sampled from 12 individuals
for each species. Assume that the variances are equal.
2 samples T-test
x<-c(12,12,13,14,15,16,12,13,12,13,13,12)
y<-c(8,9,11,11,12,13,13,12,12,13,12,12)
t.test(x, y, alternative = "two.sided", var.equal = TRUE)
##
## Two Sample t-test
##
## data: x and y
## t = 2.6846, df = 22, p-value = 0.01354
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.3601815 2.8064852
## sample estimates:
## mean of x mean of y
## 13.08333 11.50000