# How to Do Hypothesis Testing with Normal Distribution

Hypothesis tests compare a result up against something you already believe is true. Let ${X}_{1},{X}_{2},\dots ,{X}_{n}$ be $n$ independent random variables with equal expected value $\mu$ and standard deviation $\sigma$. Let $\overline{X}$ be the mean of these $n$ random variables, so

 $\overline{X}=\frac{1}{n}\sum _{i=1}^{n}{X}_{i}.$

The stochastic variable $\overline{X}$ has expected value $\mu$ and standard deviation $\frac{\sigma }{\sqrt{n}}$. You want to perform a hypothesis test on this expected value. You have a null hypothesis ${H}_{0}:\mu ={\mu }_{0}$ and three possible alternative hypotheses: ${H}_{a}:\mu <{\mu }_{0}$, ${H}_{a}:\mu >{\mu }_{0}$ or ${H}_{a}:\mu \ne {\mu }_{0}$. The first two alternative hypotheses belong to what you call a one-sided test, while the latter is two-sided.

In hypothesis testing, you calculate with the alternative hypothesis to say something about the null hypothesis.

Rule

### HypothesisTesting(NormalDistribution)

1.
You set up the null hypothesis ${H}_{0}$ against an alternative hypothesis ${H}_{A}$. ${H}_{0}:\mu ={\mu }_{0}$ against ${H}_{a}:\mu >{\mu }_{0}$ (possibly ${H}_{a}:\mu <{\mu }_{0}$, ${H}_{a}:\mu \ne {\mu }_{0}$).
2.
Then you do an experiment and find that the average value is $\overline{x}$. Next, you calculate the probability $P\phantom{\rule{-0.17em}{0ex}}\left(\overline{X}\ge \overline{x}\right)$ for the alternative hypothesis ${H}_{a}:\mu >{\mu }_{0}$.
3.
If this probability is less than $1$ %, $5$ % or $10$ %, you discard ${H}_{0}$.

Note! For two-sided testing, multiply the $p$-value by 2 before checking against critical region.

Example 1

As production manager in the new soft drink factory, you are worried that the machines don’t fill the bottles properly. Each bottle should be filled with $\text{}0.5\text{}\phantom{\rule{0.17em}{0ex}}\text{L}$ soda, but random samples show that 48 soda bottles have an average of $\text{}0.48\text{}\phantom{\rule{0.17em}{0ex}}\text{L}$, with an empirical standard deviation of $\text{}0.1\text{}$. You are wondering if you need to recalibrate the machines so that they become more precise.

This is a classic case of hypothesis testing by normal distribution. You now follow the instructions above and select $10$ % level of significance, since it is only a quantity of soda and not a case of life and death.

1.
The null hypothesis is that there is $0.5$ L in each bottle:
 ${\mu }_{0}=0.5.$

The alternative hypothesis in this case is that the bottles do not contain $0.5$ L and that the machines are not precise enough. This thus becomes a two-sided hypothesis test and you must therefore remember to multiply the $p$-value by 2 before deciding whether the $p$-value is in the critical region. This is because the normal distribution is symmetric, so $P\phantom{\rule{-0.17em}{0ex}}\left(X\ge k\right)=P\phantom{\rule{-0.17em}{0ex}}\left(X\le -k\right)$. Thus it is just as likely to observe an equally extremely high value as an equally extreme low:

 ${\mu }_{0}\ne 0.5.$
2.
Find the $p$-value by calculating $P\phantom{\rule{-0.17em}{0ex}}\left(\overline{X}\ge 0.48\right)$: $\begin{array}{llll}\hfill P\phantom{\rule{-0.17em}{0ex}}\left(\overline{X}\le 0.48\right)& =P\phantom{\rule{-0.17em}{0ex}}\left(Z\le \genfrac{}{}{1.0pt}{}{\phantom{\rule{0.17em}{0ex}}0.48-0.5\phantom{\rule{0.17em}{0ex}}}{\phantom{\rule{0.17em}{0ex}}\frac{0.1}{\sqrt{48}}\phantom{\rule{0.17em}{0ex}}}\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =P\phantom{\rule{-0.17em}{0ex}}\left(Z\le -1.39\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =0.0823\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & ⇕\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill p& =0.0823\cdot 2\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =0.1646\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =16.46\phantom{\rule{0.17em}{0ex}}\text{%}.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$
3.
You have chosen that if the machines are to be recalibrated your $p$-value must be less than $10$ %. Therefore, there must be less than $10$ % chance of the machine filling $0.5$ L on average in the bottles. Your $p$-value is
 $p=16.46\phantom{\rule{0.17em}{0ex}}\text{%}>10\phantom{\rule{0.17em}{0ex}}\text{%},$

so that ${H}_{0}$ must be kept and the machines are fine as is.

Had the $p$-value been less than the level of significance, that would have meant that the calibration represented by the alternative hypothesis is significantly better for the business.