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

Conventionally, In a two-tail test, the null hypothesis states that the true population mean (μo) is equal to the hypothesized mean value (μ). We fail to reject the null hypothesis if the test statistic lies within the range of critical values at the chosen significance level. In this article let us discuss the probability percentage of type II error for a two-tail test of the population mean with known variance.

Type II error is an error that occurs if the hypothesis test based on a random sample fails to reject the null hypothesis even when the true population mean μo is not equal to the hypothesized mean value μ.

Here the assumption is the population variance σ2 is known. From Central Limit Theorem (CLT), the population. the sample means of all possible samples of a population approximately follow a normal distribution. Based on this fact, we can compute the range of sample means for which the type II error can occur, and obtain an estimate of the probability of type II error.

Let us try to understand the type II error by considering a case study.

Suppose the mean weight of boxers in Asia last year was 75.4 kg. In a sample of 35 boxers same time this year in the same region, the mean boxer’s weight is 74.6 kg. Assume the population standard deviation is 2.5 kg. At the .05 significance level, can we reject the null hypothesis that the mean boxer’s weight does not differ from last year?

**Example:**

The null hypothesis is that μ = 75.4. Let us compute the test statistic.

## R

`xbar = 74.6 ` `# sample mean ` `mu0 = 75.4 ` `# hypothesized value ` `sigma = 2.5 ` `# population standard deviation ` `n = 35 ` `# sample size ` `z = (xbar-mu0)/(sigma/` `sqrt` `(n)) ` `z` |

**Output:**

-1.8931455305919

Now let us compute the critical values

## R

`alpha = .05 ` `z.half.alpha = ` `qnorm` `(1-alpha/2) ` `c` `(-z.half.alpha, z.half.alpha)` |

**Output:**

-1.95996398454005 1.95996398454005

The range of the critical values (-1.96 – +1.96) suggests that the test statistic -1.8931 lies well within the range. Hence, at the .05 significance level, we do not reject the null hypothesis that the mean boxer’s weight does not differ from last year.