## One sample t test

Let $X_1, X_2, \cdots, X_n$ be a random sample from a normal population with mean $\mu$ and unknown variance $\sigma^2$.

The hypothesis problem can be setup as

Situation Hypothesis Testing Problem
Situation A $H_0: \mu=\mu_0$ against $H_a : \mu < \mu_0$ (Left-tailed)
Situation B $H_0: \mu=\mu_0$ against $H_a : \mu > \mu_0$ (Right-tailed)
Situation C $H_0: \mu=\mu_0$ against $H_a : \mu \neq \mu_0$ (Two-tailed)

## Formula

The test statistic under $H_0: \mu=\mu_0$ is

### $t = \dfrac{\overline{x}-\mu_0}{SE(\overline{x})}$

where,

• $\overline{x}=\dfrac{1}{n} \sum x_i$ is the sample mean,
• $SE(\overline{x})=\dfrac{s}{\sqrt{n}}$ is the standard error of mean,
• $s^2 =\dfrac{1}{n-1} \sum (x_i -\overline{x})^2$ is the sample variance.

The test statistic $t$ follows $t$ distribution with $n-1$ degrees of freedom.