8.4.6 Solved Problems

Problem

Let $X \sim Geometric(\theta)$. We observe $X$ and we need to decide between



$\quad$ $H_0$: $\theta=\theta_0=0.5$,

$\quad$ $H_1$: $\theta=\theta_1=0.1$

  1. Design a level $0.05$ test ($\alpha=0.05)$ to decide between $H_0$ and $H_1$.
  2. Find the probability of type-II error $\beta$.
  • Solution
      1. We choose a threshold $c \in \mathbb{N}$ and compare the observed value of $X=x$ to $c$. We accept $H_0$ if $x \leq c$ and reject it if $x >c$. The probability of type I error is given by \begin{align}%\label{} P(\textrm{type I error})&=P(\textrm{Reject }H_0 \; | \; H_0)\\ &=P(\textrm{Reject }H_0 \; | \; \theta=0.5)\\ &=P(X>c \; | \; \theta=0.5)\\ &=\sum_{k=c+1}^{\infty} P(X=k) \quad \big(\textrm{where } X \sim Geometric(\theta_0=0.5)\big)\\ &=\sum_{k=c+1}^{\infty} (1-\theta_0)^{k-1} \theta_0\\ &=(1-\theta_0)^c \theta_0 \sum_{l=0}^{\infty} (1-\theta_0)^{l}\\ &=(1-\theta_0)^c. \end{align} To have $\alpha=0.05$, we need to choose $c$ such that $(1-\theta_0)^c \leq \alpha=0.05$, so we obtain \begin{align}%\label{} c&\geq \frac{\ln \alpha}{\ln (1-\theta_0)}\\ &=\frac{\ln (0.05)}{\ln (.5)}\\ &=4.32 \end{align} Since we would like $c \in \mathbb{N}$, we can let $c=5$. To summarize, we have the following decision rule: Accept $H_0$ if the observed value of $X$ is in the set $A=\{1,2,3,4,5\}$, and reject $H_0$ otherwise.
      2. Since the alternative hypothesis $H_1$ is a simple hypothesis ($\theta=\theta_1$), there is only one value for $\beta$, \begin{align} \beta&=P(\textrm{type II error}) = P(\textrm{accept }H_0 \; | \; H_1) \\ &= P(X \leq c \; | \; H_1)\\ &= 1-(1-\theta_1)^c\\ &= 1-(0.9)^5\\ &=0.41 \end{align}


Problem

Let $X_1$,$X_2$,$X_3$, $X_4$ be a random sample from a $N(\mu,1)$ distribution, where $\mu$ is unknown. Suppose that we have observed the following values

\begin{equation} \; 2.82 \quad 2.71 \quad 3.22 \quad 2.67 \end{equation} We would like to decide between

$\quad$ $H_0$: $\mu=\mu_0=2$,

$\quad$ $H_1$: $\mu \neq 2$.

  1. Assuming $\alpha=0.1$, Do you accept $H_0$ or $H_1$?
  2. If we require significance level $\alpha$, find $\beta$ as a function of $\mu$ and $\alpha$.
  • Solution
      1. We have a sample from a normal distribution with known variance, so using the first row in Table 8.2, we define the test statistic as \begin{align}%\label{} W&=\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}. \end{align} We have $\overline{X}=2.85$, $\mu_0=2$, $\sigma=1$, and $n=4$. So, we obtain \begin{align}%\label{} W&=\frac{2.85-2}{1 / 2}\\ &=1.7 \end{align} Here, $\alpha=0.1$, so $z_{\frac{\alpha}{2}}=z_{0.05}=1.645$. Since \begin{align}%\label{} |W|>z_{\frac{\alpha}{2}}, \end{align} we reject $H_0$ and accept $H_1$.
      2. Here, the test statistic $W$ is \begin{align}%\label{} W \sim &=2(\overline{X}-2). \end{align} If $X \sim N\left(\mu, 1\right)$, then \begin{align}%\label{} \overline{X} \sim N\left(\mu, \frac{1}{4}\right), \end{align} and \begin{align}%\label{} W \sim N(2(\mu-2),1). \end{align} Thus, we have \begin{align} \beta&=P(\textrm{type II error}) = P(\textrm{accept }H_0 \; | \; \mu) \\ &= P(|W| \lt z_{\frac{\alpha}{2}} \; | \; \mu)\\ &= P(|W| \lt z_{\frac{\alpha}{2}}) \quad \big(\textrm{when }W \sim N(2(\mu-2),1)\big)\\ &= \Phi \left(z_{\frac{\alpha}{2}}-2\mu+4\right)-\Phi \left(-z_{\frac{\alpha}{2}}-2\mu+4\right). \end{align}


Problem

Let $X_1$,$X_2$,...,$X_{100}$ be a random sample from an unknown distribution. After observing this sample, the sample mean and the sample variance are calculated to be

\begin{equation} \overline{X}=21.32, \quad S^2=27.6 \end{equation} Design a level $0.05$ test to choose between

$\quad$ $H_0$: $\mu=20$,

$\quad$ $H_1$: $\mu > 20$.

Do you accept or reject $H_0$?
  • Solution
    • Here, we have a non-normal sample, where $n=100$ is large. As we have discussed previously, to test for the above hypotheses, we can use the results of Table 8.3. More specifically, using the second row of Table 8.3, we define the test statistic as \begin{align}%\label{} W&=\frac{\overline{X}-\mu_0}{S / \sqrt{n}}\\ &=\frac{21.32-20}{\sqrt{27.6} / \sqrt{100}}\\ &=2.51 \end{align} Here, $\alpha=0.05$, so $z_{\alpha}=z_{0.05}=1.645$. Since \begin{align}%\label{} W>z_{\alpha}, \end{align} we reject $H_0$ and accept $H_1$.


Problem Let $X_1$,$X_2$,$X_3$, $X_4$ be a random sample from a $N(\mu,\sigma^2)$ distribution, where $\mu$ and $\sigma$ are unknown. Suppose that we have observed the following values \begin{equation} \; 3.58 \quad 10.03 \quad 4.77 \quad 14.66 \end{equation} We would like to decide between

$\quad$ $H_0$: $\mu \geq 10$,

$\quad$ $H_1$: $\mu \lt 10$.

Assuming $\alpha=0.05$, Do you accept $H_0$ or $H_1$?
  • Solution
    • Here, we have a sample from a normal distribution with unknown mean and unknown variance. Thus, using the third row in Table 8.4, we define the test statistic as \begin{align}%\label{} W&=\frac{\overline{X}-\mu_0}{S / \sqrt{n}}. \end{align} Using the data we obtain \begin{align}%\label{} \overline{X}&=8.26, \quad S=5.10 \end{align} Therefore, we obtain \begin{align}%\label{} W&=\frac{8.26-10}{5.10 / 2}\\ &=-0.68 \end{align} Here, $\alpha=0.05$, so $n=4$, $t_{\alpha,n-1}=t_{0.05,3}=2.35$. Since \begin{align}%\label{} W > -t_{\alpha,n-1}, \end{align} we fail to reject $H_0$, so we accept $H_0$.


Problem Let $X_1$,$X_2$,...,$X_{81}$ be a random sample from an unknown distribution. After observing this sample, the sample mean and the sample variance are calculated to be \begin{equation} \overline{X}=8.25, \quad S^2=14.6 \end{equation} Design a test to decide between

$\quad$ $H_0$: $\mu=9$,

$\quad$ $H_1$: $\mu \lt 9$,

and calculate the $P$-value for the observed data.
  • Solution
    • Here, we have a non-normal sample, where $n=81$ is large. As we have discussed previously, to test for the above hypotheses, we can use the results of Table 8.4. More specifically, using the second row of Table 8.4, we define the test statistic as \begin{align}%\label{} W&=\frac{\overline{X}-\mu_0}{S / \sqrt{n}}\\ &=\frac{8.25-9}{\sqrt{14.6} / \sqrt{81}}\\ &=-1.767 \end{align} The $P$-value is $P(\textrm{type I error})$ when the test threshold $c$ is chosen to be $c=-1.767$. Since the threshold for this test (as indicated by Table 8.4) is $-z_{\alpha}$, we obtain \begin{align}%\label{} -z_{\alpha}=-1.767 \end{align} Noting that by definition $z_{\alpha}=\Phi^{-1}(1-\alpha)$, we obtain $P(\textrm{type I error})$ as \begin{align}%\label{} \alpha=1-\Phi(1.767) \approx 0.0386 \end{align} Therefore, \begin{align}%\label{} P-\textrm{value} \approx 0.0386 \end{align}




The print version of the book is available on Amazon.

Book Cover


Practical uncertainty: Useful Ideas in Decision-Making, Risk, Randomness, & AI

ractical Uncertaintly Cover