2025

Introduction to two-tailed tests

  • We have seen that one-tailed tests are used to determine if the mean of a sample is significantly greater than or less than a hypothesized value.

  • Two-tailed tests are used to determine if the mean of a sample is significantly different from a hypothesized value.

Imagine two universes

  • Null Universe: The neuron is not stimulus-driven. The Expected Value of \(X\) is 10 spikes per second.

  • Alternative Universe: The neuron is stimulus-driven but the drive can be excitatory or inhibitory.

  • We want to know which universe we are in.

  • We write this as:

\[ \begin{align*} H_0 &: \mu_X = 10 \\ H_1 &: \mu_X \neq 10 \end{align*} \]

The null universe

Two-tailed p-value

Two-tailed recipe

  • Everything proceeds the same as for a one-tailed test until you get to the p-value calculation.

  • At that stage, you must mirror the observed test statistic value (e.g., the observed sample mean) across the center of the null distribution and compute the area under the curve in both tails.

  1. Specify the null and alternative hypotheses (\(H_0\) and \(H_1\)) in terms of a population parameter \(\theta\).

  2. Specify the type I error rate – denoted by the symbol \(\alpha\) – you are willing to tolerate.

  3. Specify the sample statistic \(\widehat{\theta}\) that you will use to estimate the population parameter \(\theta\) in step 1 and state how it is distributed under the assumption that \(H_0\) is true.

  4. Obtain a random sample and use it to compute the sample statistic from step 3. Call this value \(\widehat{\theta}_{\text{obs}}\).

  5. If \(\widehat{\theta}_{\text{obs}}\) or a more extreme outcome in either tail is very unlikely to occur under the assumption that \(H_0\) is true, then reject \(H_0\). Otherwise, do not reject \(H_0\).

Two-tailed example

  • Suppose a neuron has a baseline firing rate of 10 spikes/sec. After presenting a stimulus, we record a sample of 25 trials, and observe:

    \[ \bar{X}_{\text{obs}} = 9.85 \text{ spikes/sec} \]

  • We want to test:

    \[ \begin{align*} H_0 &: \mu_X = 10 \\ H_1 &: \mu_X \neq 10 \end{align*} \]

  • Under \(H_0\), \(\bar{X} \sim \mathscr{N}(10, \frac{1^2}{25}) = \mathscr{N}(10, 0.04)\)

  • The two-tailed p-value by calculating the area under both tails beyond the mirrored observed value:

    \[ p = P(\bar{X} \leq 9.85) + P(\bar{X} \geq 10.15) \]

  • This tells us how likely we are to see a value this far (or farther) from 10 — in either direction — if the null is true.

  • In this case, \(p = 0.4597\), which you would compute using pnorm() in R if you needed to.