Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Data Visualization
  • Statistics in R
  • Machine Learning in R
  • Data Science in R
  • Packages in R
  • Data Types
  • String
  • Array
  • Vector
  • Lists
  • Matrices
  • Oops in R
Open In App
Next Article:
Type II Error in Two-Tailed Test of Population Mean with Unknown Variance in R
Next article icon

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

Last Updated : 22 Jun, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will cover type II Errors in the Two-Tailed Test of Population Mean with Unknown Variance.

Conventionally, In a two-tail test is used in null-hypothesis testing. The null hypothesis (μ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. 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 not equal to the hypothesized mean value μ.

Here the assumption is the population variance σ2  is unknown. Let s2 be the sample variance. For larger n (usually >30), the population of the following statistics of all possible samples of size n is approximately a Student t distribution with n-1 degree of freedom (DOF).

The range of sample means for a student t distribution is calculated as follows.

t = \frac{\bar{X}-\mu }{s /\sqrt{n}}

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 sample standard deviation is 2.5 kg.  Is there enough evidence to reject the null hypothesis that the mean boxer's weight does not differ from last year at 0.05 significance

Let us start by computing the standard error estimate

R
# sample size  n = 35    # sample standard deviation  s = 2.5                SE = s/sqrt(n);  SE   

Output:

0.422577127364258

We next compute the lower and upper bounds of sample means for which the null hypothesis μo = 74.6 would not be rejected. In the output 73.74 is the lower bound whereas, 75.45 is upper bound.

R
# significance level  alpha = .05       # hypothetical mean  mu0 = 15.4            I = c(alpha/2, 1-alpha/2)  q = mu0 + qt(I, df=n-1) * SE; q  

Output:

73.7412199531507      75.4587800468493

The upper and lower bounds suggest as long as the sample mean is between 73.741 and 75.458 in a hypothesis test, the null hypothesis will not be rejected. Since we assume that the actual population mean is 75.4kg, we can compute the lower tail probabilities of both endpoints.

R
# assumed actual mean  mu = 75.4              p = pt((q - mu)/SE, df=n-1); p 

Output:

0.000200411362802067     0.554903698326656

Finally, the probability % of type II error is the probability between the two endpoints found by finding the difference between the two endpoints.

R
diff(p)  

Output:

0.554703286963854

Here we can understand that, If the boxers sample size is 35, the sample standard deviation of the boxer's weight is 2.5 kg and the actual mean population weight is 75.4  kg, then the probability of type II error for testing the null hypothesis μ = 75.4 at .05 significance level is 55.47%, and the power of the hypothesis test is 44.53%.


Next Article
Type II Error in Two-Tailed Test of Population Mean with Unknown Variance in R

J

jssuriyakumar
Improve
Article Tags :
  • R Language
  • R-Statistics

Similar Reads

    Type II Error in Upper Tail Test of Population Mean with Unknown Variance in R
    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 di
    3 min read
    Type II Error in Lower Tail Test of Population Mean with Unknown 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
    3 min read
    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
    2 min read
    Two-Tailed Test of Population Mean with Unknown 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
    3 min read
    Type II Error in Upper Tail Test of Population Mean with Known Variance in R
    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 di
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences