So, what about our university teacher and his bunch of clever students? First, let’s check what is known about the sample:

  1. List of the things you should know:

    • the mean/reference of the population, µ (here µ=120)
    • the number of observations in your sample, n (here n=40)
    • the sample mean, M (here M=126.35)
    • the standard deviation for the sample, sd (here sd=10.14)
    • the standard deviation for the population, SD (unknown in our example)
  2. Assumptions:

    • the variable is continuous
    • the data are independent (no relationship between observations)
    • the variable has a normal distribution
  3. The null hypothesis to be tested:

    • H0: the sample mean M equals the population mean µ.
  4. Our alternative hypothesis:

    • Ha: the sample mean M is greater than the population mean µ (our teacher has the feeling that the student are clever, meaning that their IQ is higher than average).

We do not know the standard deviation of the population, SD. Thus we have to run a one-sample t-test. In R, we had previously stored our data in scores. We just need to enter the following command:

t.test(scores, alternative="greater", mu = 120)
## 
##  One Sample t-test
## 
## data:  scores
## t = 3.9591, df = 39, p-value = 0.0001547
## alternative hypothesis: true mean is greater than 120
## 95 percent confidence interval:
##  123.6476      Inf
## sample estimates:
## mean of x 
##    126.35

As you may read above here, a p-value less than 0.05 (0.0001547) has been “delivered” by t.test(). This means that our alternative hypothesis Ha is accepted. Our teacher’s feeling about his students was correct, assuming that using IQ score for this purpose makes sense…