[Math] Type I error in Normal distributions

normal distributionprobability

Let $X_1,\dots , X_n \stackrel{iid}{\sim} N(\mu, \sigma^2 = 4)$ Test $H_0: \mu = 10$ vs $H_1: \mu > 10$ take a random sample of $n=16$ and reject $H_0$ if $\bar{x}>14$

Find $\alpha$ the type I error probability

Im using $\bar{x} \stackrel{H_0}{\sim} N(10,\frac{4}{16})$

Test statistic formula is

$Z=\frac{\bar{X-\mu}}{\frac{\sigma}{\sqrt{n}}}\stackrel{H_0}{\sim} N(0,1)$

Using $\alpha= P(\bar{X}>14)= P(Z> \frac{14-10}{\frac{2}{\sqrt{16}}})$ to reject $H_0$ I get $P(Z >8)$

I plugged it in R as $1-P(Z \leq8)$ which gives a value of $6.6612^{-16}$ which is ridiculously small. Am I doing this correctly?

Thanks in advance

Best Answer

Yes, you've done it correctly. However, there is some inaccuracy in your answer due to the floating-point roundoff error which happens because you are subtracting $P(Z \leq 8)$, which is close to 1, from 1:

> 1-pnorm(8)
[1] 6.661338e-16

Instead of this, a better method is to use the option `lower.tail=FALSE' to give the upper tail directly:

pnorm(8,lower.tail=FALSE)
[1] 6.220961e-16

or equivalently, using the symmetry of the standard normal distribution,

> pnorm(-8)
[1] 6.220961e-16
Related Question