Skip to content
Related Articles

Related Articles

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

View Discussion
Improve Article
Save Article
  • Last Updated : 02 Jun, 2022
View Discussion
Improve Article
Save Article

Conventionally, In an upper-tail test, the null hypothesis states that the true population mean (μo) is less than the hypothesized mean value (μ). We fail to reject the null hypothesis if the test statistic is lesser than the critical value at the chosen significance level. In this article let us discuss the probability percentage of type II error for an upper-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 means μo is greater than the hypothesized mean value μ.

Here the assumption is the population variance σ 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.

Assume the data labeling company states that there are less than 2 errors in marked labels on any single page. Assume the actual mean amount of error per page  2.12, and the population standard deviation is 0.2. At the .05 significance level, what is the probability of having a type II error for a sample size of 40 pages?

Example:

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

R




n = 40 # sample size 
sigma = 0.2 # population standard deviation 
sem = sigma/sqrt(n); 
sem   # standard error 

Output:

0.03162277

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

R




alpha = .05 # significance level 
mu0 = 2 # hypothetical upper bound 
q = qnorm(alpha, mean=mu0, sd=sem, 
          lower.tail=FALSE); 
q

Output:

2.0520148

The upper bound value denotes, that so long as the sample mean is less than 2.0520 in a hypothesis test, the null hypothesis will not be rejected. Since we assume that the actual population mean is 2.12, we can compute the probability of the sample mean below 2.0520 and thereby find the probability of type II error.

R




mu = 2.12 # assumed actual mean 
pnorm(q, mean=mu, sd=sem)

Output: 

0.015782371207159

If the sample size is 40, the actual mean amount of errors per page is 2.12 and the population standard deviation is 0.2, then the probability of type II error for testing the null hypothesis μ ≤ 2 at .05 significance level is 1.57%, and the power of the hypothesis test is 98.43%.


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!