The t Test
Let $X_1,X_2,…,X_n$ be a random sample from the normal distribution with mean $\mu$ and unknown variance $\sigma^2$.
Consider testing the simple versus simple hypotheses
\[H_0:\mu=\mu_0\qquad H_1:\mu\lt\mu_0\]where $\mu_0$ is fixed and known.
It was based on the fact that
\[\overline{X}\sim N(\mu,\sigma^2/n)\]and
\[\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}\sim N(0,1)\]What if we use the sample standard deviation $S=\sqrt{S^2}$ in place of $\sigma$?
\[\begin{align} \frac{\overline{X}-\mu}{S/\sqrt{n}}&=\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}.\frac{\sigma}{S}=\frac{\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}}{\frac{S}{\sigma}}\\ &=\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}\bigg/\sqrt{\frac{S^2}{\sigma^2}}\\ &=\underbrace{\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}}_{N(0,1)}\bigg/\sqrt{\frac{\overbrace{\frac{(n-1)S^2}{\sigma^2}}^{\chi^2(n-1)}}{n-1}}\\ \end{align}\]For the normal distribution, $\overline{X}$ and $S^2$ are independent.
Thus,
\[\frac{\overline{X}-\mu}{S/\sqrt{n}}\sim t(n-1)\]Step One:
Choose an estimator for $\mu$.
\[\widehat{\mu}=\overline{X}\] Step Two:Give the “form” of the test.
Reject $H_0$, in favor of $H_1$ if $\overline{X}\lt c$, where $c$ is to be determined.
Step Three:Find $c$.
\[\begin{align} \alpha&=\underset{\mu=\mu_0}{\text{max}}P(\text{Type I Error})\\ &=\underset{\mu=\mu_0}{\text{max}}P(\text{Reject }H_0;\mu)\\ &=P(\text{Reject }H_0;\mu_0)\\ &=P(\overline{X}\lt c;\mu_0)\\ &=P\Bigg(\underbrace{\frac{\overline{X}-\mu_0}{S/\sqrt{n}}}_{t(n-1)}\lt\frac{c-\mu_0}{S/\sqrt{n}};\mu_0\Bigg)\\ &=P\Bigg(T\lt\frac{c-\mu_0}{S/\sqrt{n}}\Bigg)\\ &\text{Where }T\sim t(n-1)\\ \end{align}\] \[\implies \frac{c-\mu_0}{S/\sqrt{n}}=t_{1-\alpha,n-1}\] Step Four:Conclusion!
Reject $H_0$, in favor of $H_1$, if
$$ \overline{X}\lt\mu_0+t_{1-\alpha,n-1}\frac{S}{\sqrt{n}} $$Example
In 2019, the average health care annual premium for a family of 4 in the United States, was reported to be \$6,015.
In a more recent survey, 15 randomly sampled families of 4 reported an average annual health care premium of \$6,033 and a sample variance of \$825.
Can we say that the true average is currently greater that \$6,015 for all families of 4? Use $\alpha=0.10$.
Assume that annual health care premiums are normally distributed.
Let $\mu$ be the true average for all families of 4.
Step Zero:Set up the hypotheses.
\[H_0:\mu=6015\qquad H_1:\mu\gt6015\] Step One:Choose a test statistic.
\[\overline{X}\] Step Two:Give the form of the test.
Reject $H_0$, in favor of $H_1$, if $\overline{X}\gt c$ where $c$ is to be determined.
Step Three:Find $c$.
\[\begin{align} \alpha&=\underset{\mu=\mu_0}{\text{max}}P(\text{Type I Error})\\ &=\underset{\mu=6015}{\text{max}}P(\text{Reject }H_0;\mu)\\ &=P(\text{Reject }H_0;\mu=6015)\\ &=P(\overline{X}\lt c;\mu=6015)\\ &=P\Bigg(\frac{\overline{X}-\mu_0}{S/\sqrt{n}}\gt\frac{c-6015}{\sqrt{825}/\sqrt{15}};\mu=6015\Bigg)\\ &=P\Bigg(T\gt\frac{c-6015}{\sqrt{825}/\sqrt{15}}\Bigg)\\ &\text{Where }t\sim t(14) \end{align}\]In R:
qt(0.9, 14)
$t_{\alpha,n-1}=1.345$
\[\begin{align} &\implies\frac{c-6015}{\sqrt{825}/\sqrt{15}}=1.345\\ &\implies c=6024.98 \end{align}\] Step Four:Conclusion!
Rejection Rule:
-
Reject $H_0$, in favor of $H_1$, if
\[\overline{X}\gt6024.98\] -
We had $\overline{x}=6033$ so we reject $H_0$.
There is sufficient evidence (at level $0.10$) in the data to suggest that the true mean annual health care premium cost for a family of 4 is greater than \$6,015.
P-value
\[\begin{align} &=P(\overline{X}\gt6033;\mu=6015)\\ &=P\Bigg(\frac{\overline{X}-\mu_0}{S/\sqrt{n}}\gt\frac{6033-6015}{\sqrt{825}/\sqrt{15}};\mu=6015\Bigg)\\ &=P(T\gt2.43)\approx0.015\\ &\text{where }T\sim t(14) \end{align}\]In R:
1 - pt(2.43, 14)