Topic 6 One-sample t-test

6.1 Intuition (extra)

Recall that the one-sample t-test is simply a way to test a null hypothesis for a variable in a single sample. To do a t-test, we do the following:

  • We standardize the difference between the sample mean and the guess of population mean. This is the same type of standardization that we did with z-scores. The standardization gives a value of \(t\) (we called it a \(t\) statistic). It follows a t-distribution (when our original distribution is normal). The mean of the distribution is 0.

  • We check where our calculated \(t\) follows in the t-distribution.

  • If \(t = 0\), the guessed population mean equals the sample mean, so our guess is correct and we do not reject the null.

  • What if \(t\neq 0\) ? This means that the mean of this sample is not equal to our guess. But does that mean that our guess is wrong for other samples of the same population? We need to be carefull with our conclusions since we do not want to reject a true null (type I error).

  • What do we do? We ask ourselves: how far from 0 does \(t\) have to be so we can say our guess is wrong for the population? If \(\alpha = 0.5\), we say it has to be far enough that it represents only 5% of the distribution (it is in the 95th percentile for a one-sided test or 97.5th percentile for a two-sided test).

Therefore, we reject the null hypothesis when we have a value of \(t\) that is high enough, that it would only happen 5% (or less) of the times if the distribution actually has mean 0.

6.2 Formula for the one-sample t-test

\[t = \frac {\bar x-\mu_0}{se}\] Recall that:

\[se = \frac{sd}{\sqrt{n}}\]

6.3 Interpretation

6.3.1 Option 1: t values

Once we have \(t\) we compare it to a value \(c_\alpha\) which represents a value of \(t\) that has only \(\alpha\) chance of happening. For \(\alpha = .05\), we compare it to a value \(c_{.05}\). We call \(c_\alpha\) the critical value.

  • We do not need to calculate these values. They are in a t-table.
  • Note that degrees of freedom = \(n-1\).

To use those tables, look for \(t_{(1-\alpha)}\) for a one sided test or \(t_{(1-\frac{\alpha}{2})}\) for a two-sided test.

In short:

  • if the calculated \(t\) is higher than the critical value (\(t_{critical}\)), we reject the null hypothesis.
  • if the calculated \(t\) is lower than the critical value (\(t_{critical}\)), we do not reject the null hypothesis.

6.3.2 Option 2: p-values

Another to interpret is to look at what is called a p-value or significance level.

A p-value gives the chance (or probability) of your calculated \(t\) statistic being selected in a t-distribution. It gives us the minimum \(\alpha\) for which we could reject the null, that is why we call it the significance level.

General rule:

  • For \(\alpha = .05\) (95% confidence level), we reject the null hypothesis only when \(p \leq 0.05\)
  • For \(\alpha = .01\) (99% confidence level), we reject the null hypothesis only when \(p \leq 0.01\)

6.3.3 Option 3: Mean difference CI

Recall, sample standard error:

\[se = \frac{sd}{\sqrt{n}}\]

Confidence interval for the population mean difference

\[\text{Lower bound} = \bar x_{difference} - t_{(1-\frac{\alpha}{2})}se\]

\[\text{Upper bound} = \bar x_{difference} + t_{(1-\frac{\alpha}{2})}se\]

  • If the CI includes 0, then we do not reject the null hypothesis.
  • If the CI does not include 0, we reject the null hypothesis.

6.4 Exercises

We will examine different datasets in class. Here are some questions to consider each time:

  1. Which value of \(\mu_0\) should you choose if you want to test if the sample mean = population mean?
  2. How do you interpret your p-value?
  3. How do you interpret your confidence interval?
  4. What is your conclusion about the population mean?