# Type II Error in Upper Tail Test of Population Mean with Unknown Variance

In a upper tail test of the population mean, the null hypothesis claims that the true
population mean μ is less than 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 greater
than μ_{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 food label on a cookie bag states that there is at most 2 grams of saturated fat in a single cookie. Assume in a random sample of 35 cookies, the standard deviation of saturated fat is 0.3 grams. If actual mean amount of saturated fat per cookie is 2.09 grams, 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 = 0.3 # sample standard deviation

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

[1] 0.050709

We next compute the upper bound of sample means for which the null hypothesis μ ≤ 2 would not be rejected.

> mu0 = 2 # hypothetical upper bound

> q = mu0 + qt(alpha, df=n-1, lower.tail=FALSE) * SE; q

[1] 2.0857

Therefore, so long as the sample mean is less than 2.0857 in a hypothesis test, the null hypothesis will not be rejected. Since we assume that the actual population mean is 2.09, we can compute the probability of the sample mean below 2.0857, and thus found the probability of type II error.

#### Answer

If the cookies sample size is 35, the sample standard deviation of saturated fat per cookie is 0.3 grams and the actual mean amount of saturated fat per cookie is 2.09 grams, then the probability of type II error for testing the null hypothesis μ ≤ 2 at .05 significance level is 46.7%, and the power of the hypothesis test is 53.3%.

#### Exercise

Under same assumptions as above, if the actual mean saturated fat per cookie is 2.075 grams, what is the probability of type II errors? What is the power of the hypothesis test?