# Type II Error in Two-Tailed Test of Population Mean with Unknown Variance

In a two-tailed test of the population mean, the null hypothesis claims that the true
population mean μ is equal to a given hypothetical value μ_{0}.

A type II error occurs if the hypothesis test based on a random sample fails to
reject the null hypothesis even when the true population mean μ is in fact different
from μ_{0}.

Let s^{2} be the sample variance. For sufficiently large n, the population of the
following statistics of all possible samples of size n is approximately a Student t
distribution with n - 1 degrees of freedom.

This allows us to compute the range of sample means for which the null hypothesis will not be rejected, and to obtain the probability of type II error. We demonstrate the procedure with the following:

#### Problem

Suppose the mean weight of King Penguins found in an Antarctic colony last year was 15.4 kg. Assume in a random sample 35 penguins, the standard deviation of the weight is 2.5 kg. If actual mean penguin weight is 15.1 kg, what is the probability of type II error for a hypothesis test at .05 significance level?

#### Solution

We begin with computing the standard error estimate, SE.

> s = 2.5 # sample standard deviation

> SE = s/sqrt(n); SE # standard error estimate

[1] 0.42258

We next compute the lower and upper bounds of sample means for which the null hypothesis μ = 15.4 would not be rejected.

> mu0 = 15.4 # hypothetical mean

> I = c(alpha/2, 1-alpha/2)

> q = mu0 + qt(I, df=n-1) * SE; q

[1] 14.541 16.259

Therefore, so long as the sample mean is between 14.541 and 16.259 in a hypothesis test, the null hypothesis will not be rejected. Since we assume that the actual population mean is 15.1, we can compute the lower tail probabilities of both end points.

Finally, the probability of type II error is the probability between the two end points.

#### Answer

If the penguin sample size is 35, the sample standard deviation of penguin weight is 2.5 kg and the actual mean population weight is 15.1 kg, then the probability of type II error for testing the null hypothesis μ = 15.4 at .05 significance level is 89.8%, and the power of the hypothesis test is 10.2%.

#### Exercise

Under same assumptions as above, if actual mean population weight is 14.9 kg, what is the probability of type II errors? What is the power of the hypothesis test?