# How can I compute the probability of committing a type 2 error?

Let $$X_1,...X_n$$ be an iid sample distributed as $$\mathcal{N}(\mu,1)$$. We have the following tests $$H_0: \mu=0~~~\text{vs.}~~~H_1:\mu\neq 0$$and we use the statistic $$T=\frac{1}{n}\sum_{k=1}^n X_k$$ and the test function $$\delta=\Bbb{1}_{|T|\geq Q}$$ for some $$Q>0$$. I want to find the probability of committing a type 2 error, ie compute $$\Bbb{P}_\mu(\delta=0)$$

Let observe that $$T\sim \mathcal{N}(\mu, 1/n)$$ therefore we define a random variable $$Z$$ s.t. $$Z\sim \mathcal{N}(\mu, 1/n)$$.

\begin{align}\Bbb{P}_\mu(\delta=0)&=\Bbb{P}_\mu(T-Q)\\&=\Bbb{P}(Z-Q)\\&=\Bbb{P}\left(\sqrt{n}(Z-\mu)<\sqrt{n}(Q-\mu)\right)+\Bbb{P}\left(\sqrt{n}(Z-\mu)>\sqrt{n}(-Q-\mu)\right)\\&=\Phi\left(\sqrt{n}(Q-\mu)\right)+1-\Bbb{P}\left(\sqrt{n}(Z-\mu)\leq\sqrt{n}(-Q-\mu)\right)\\&=\Phi\left(\sqrt{n}(Q-\mu)\right)+1-\Phi\left(-\sqrt{n}(Q+\mu)\right)\\&=\Phi\left(\sqrt{n}(Q-\mu)\right)+\Phi\left(\sqrt{n}(Q+\mu)\right)\end{align}

where we used that $$\sqrt(n)(Z-\mu)\sim \mathcal{N}(0,1)$$, and where $$\Phi$$ is the cumulative distribution function of a standard normal random variable. I also used that $$\Phi(-z)=1-\Phi(z)$$. But I don't think that this is correct since in class our prof. told us that the solution is $$\Phi\left(\sqrt{n}(Q-\mu)\right)-\Phi\left(\sqrt{n}(-Q-\mu)\right)$$.

Can someone tell me where my error is?

• What is your justification for $\Bbb{P}_\mu(\delta=0)=\Bbb{P}_\mu(T<Q)+ \Bbb{P}_\mu(T>-Q)$ rather than $=\Bbb{P}_\mu(-Q <T<Q)=\Bbb{P}_\mu(T<Q)- \Bbb{P}_\mu(T\le -Q)$? Jun 13, 2023 at 14:57
• @Henry hmm maybe here is my mistake. I somehow didn't thought about it, because in the exercise before we also have $\Bbb{P}(|T|\geq Q)=\Bbb{P}(T\leq -Q)+\Bbb{P}(T\geq Q)$ so I did it in the same way. Why does it then work in one but not the other case? Jun 13, 2023 at 15:02
• So $\Bbb{P}(|T|\lt Q)$ $=1-\Bbb{P}(|T|\geq Q)$ $=1-\Bbb{P}(T\leq -Q)-\Bbb{P}(T\geq Q)$ $= \Bbb{P}(T\lt Q)-\Bbb{P}(T\leq -Q)$ remembering that that you can add probabilities of disjoint events but not of intersecting events Jun 13, 2023 at 15:05
• @Henry sorry I'm still confused why wouln't I then have $\Bbb{P}(|T|\geq Q)=\Bbb{P}(T\leq -Q)-\Bbb{P}(T\geq Q)$ when I do it as in your first comment? Jun 13, 2023 at 15:08
• Subtraction of probability only works when one event is a subset of another event: for example $(T\leq -Q) \subset (T\lt Q)$ assuming $Q$ is positive but $(T\ge Q) \not\subset (T\le -Q)$ Jun 13, 2023 at 15:12

Your $$\Bbb{P}_\mu(\delta=0)=\Bbb{P}_\mu(T-Q)$$

should be $$\Bbb{P}_\mu(\delta=0)=\Bbb{P}_\mu(-Q

• But is it then true that for example $\Bbb{P}(|T|\leq Q)=\Bbb{P}(-Q\leq T\leq Q)=\Bbb{P}(T\leq Q)-\Bbb{P}(T<-Q)$ Jun 13, 2023 at 15:42
• Yes indeed it is Jun 13, 2023 at 16:00
• Perfect thanks! Jun 13, 2023 at 16:41
• I have asked a question here stats.stackexchange.com/questions/618852/… would it be possible if you could take a look at it? Jun 15, 2023 at 13:11