# Type II Error in Lower Tail Test of Population Mean with Known Variance in R

Conventionally, In a lower-tail test, the null hypothesis states that the true population mean (μo) is greater than the hypothesized mean value (μ). We fail to reject the null hypothesis if the test statistic is greater than the critical value at the chosen significance level. In this article let us discuss the probability percentage of type II error for a lower 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 lesser than 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 manufacturer claims that the mean lifetime of a tyre is more than 10,000 km. Assume the actual mean tyre lifetime is 9,950 km and the population standard deviation is 120 km. At the .05 significance level, what is the probability of having a type II error for a sample size of 30 tyres?

**Example:**

Let us start by computing the standard error of the mean as shown

## R

`# sample size ` `no_of_samples = 30 ` ` ` `# population standard deviation ` `pop_standard_dev = 120 ` ` ` `# standard error ` `std_error = pop_standard_dev/` `sqrt` `(no_of_samples); ` `std_error ` |

**Output:**

21.9089023002

Then compute the lower bound of sample means for which the null hypothesis μo >= 10000 would not be rejected.

## R

`# significance level ` `alpha = .05 ` ` ` `# sample mean ` `m0 = 10000 ` ` ` `# upper bound ` `upper_bound = ` `qnorm` `(alpha, mean=m0, ` ` ` `sd=std_error); ` `upper_bound` |

**Output:**

9963.96

The upper bound value denotes, that as long as the sample mean is greater than 9964 in a hypothesis test, the null hypothesis will not be rejected. Now, compute the probability of the sample mean being greater than 9950 because we have chosen the population mean as 9950. This will later help us to compute the probability of type II error.

## R

`population_mean = 9950 ` `pnorm` `(upper_bound, mean=population_mean, ` ` ` `sd=std_error, ` ` ` `lower.tail=` `FALSE` `)` |

**Output:**

0.2619

If the tyre sample size is 30, the actual mean tyre lifetime is 9,950 hours, and the population standard deviation is 120 km, then the probability of type II error for testing the null hypothesis μ ≥ 10000km at a .05 significance level is 26.2%, and the power of the hypothesis test is 73.8%.