6Two Samples

There is absolutely no point in carrying out an analysis that is more complicated than it needs to be. Occam's razor applies to the choice of statistical model just as strongly as to anything else: simplest is best. The so-called classical tests deal with some of the most frequently-used kinds of analysis, and they are the models of choice for:

  • comparing two variances (Fisher's F test, var.test)
  • comparing two sample means with normal errors (Student's t test, t.test)
  • comparing two means with non-normal errors (Wilcoxon's test, wilcox.test)
  • comparing two proportions (the binomial test, prop.test)
  • correlating two variables (Pearson's or Spearman's rank correlation, cor.test)
  • testing for independence in contingency tables using chi-squared (chisq.test)
  • testing small samples for correlation with Fisher's exact test (fisher.test)

Comparing Two Variances

Before we can carry out a test to compare two sample means, we need to test whether the sample variances are significantly different (see p. 55). The test could not be simpler. It is called Fisher's F test after the famous statistician and geneticist R. A. Fisher, who worked at Rothamsted in south-east England. To compare two variances, all you do is divide the larger variance by the smaller variance.

Obviously, if the variances are the same, the ratio will be 1. In order to be significantly different, the ratio will need to be significantly bigger than 1 (because the larger variance goes on top, in the numerator). ...

Get Statistics: An Introduction Using R, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.