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
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
How to Find p Value from Test Statistic
Next article icon

How to Find p Value from Test Statistic

Last Updated : 01 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

P-values are widely used in statistics and are important for many hypothesis tests. But how do we find a p-value? The method can vary depending on the specific test, but there's a general process we can follow. In this article, we'll learn how to find the p-value, get an overview of the general steps for all hypothesis tests, and see a detailed example of how to calculate a p-value.

Hypothesis tests check if a claim about a population is true. This claim is called the null hypothesis (H0). The alternative hypothesis (Ha) is what we would believe if the null hypothesis is false. Knowing how to find the p-value is crucial in testing because it helps we decide if the null hypothesis is likely true or not.

Table of Content

  • Understanding p-value and Test Statistic
  • Steps to Find p-value from Test Statistic
  • Example Calculating p-value
  • Using Statistical Software to Find p-value
  • Practical Applications of p-value

Understanding p-value and Test Statistic

To understand more about p-value and test statistics read the article added below:

p-Value

The p-value is calculated using the test statistic's sampling distribution under the null hypothesis, the sample data, and the type of test being conducted (lower-tailed, upper-tailed, or two-sided test).

Test Statistic

A test statistic measures how closely our data matches the distribution predicted by the null hypothesis of the statistical test you’re using.

Steps to Find p-value from Test Statistic

Here are steps to help calculate the p-value for a data sample:

Step-1: State Null and Alternative Hypotheses

Start by looking at our data and forming a null and alternative hypothesis. For example, we might hypothesize that the mean "μ" is 10. Thus, the alternative hypothesis is that the mean "μ" is not 10. we can write these as:

H0: μ = 10

H1: μ ≠ 10

In these hypotheses:

  • H0 is the null hypothesis.
  • H1 is the alternative hypothesis.
  • μ is the hypothesized mean.
  • ≠ means does not equal.

Step-2: Use a t-test and its Formula

After setting our hypotheses, calculate the test statistic "t" using our data set. The formula is:

t = (x̄ - μ) / (s / √n)

where,

  • t is the test statistic.
  • x̄ is the sample mean.
  • μ is the hypothesized mean.
  • s is the standard deviation of the sample.
  • n is the sample size.

Standard deviation measures how spread out the data points are in a set. It shows how close a data point is to the mean compared to other data points.

Step-3: Use a t-distribution table to find the p-value

After calculating "t," find the p-value using a t-distribution table, which we can find online. The table includes significance levels of 0.01, 0.05, and 0.1, which indicate how close the hypothesis is to the data set. To use the table, subtract 1 from our sample size "n."

For example:

n = 10

10 - 1 = 9

Use this number and our chosen significance level to find the corresponding value in the table.

If we have a one-tailed distribution, this value is our p-value. For a two-tailed distribution, which is more common, multiply this value by two to get our p-value.

Example Calculating p-value

Here’s an example of calculating the p-value based on a known set of data:

Emma wants to know if the average number of hours students study each week is 15 hours. She gathers data from a sample of students and finds that the sample mean is 13 hours, with a standard deviation of 3 hours. She decides to perform a two-tailed t-test to find the p-value at a 0.05 significance level to determine if 15 hours is the true mean. She forms the following hypotheses:

  • H0: μ = 15 hours
  • H1: μ ≠ 15 hours

After forming her hypotheses, she calculates the absolute value, or "|t|," of the test like this:

  • t = (13 - 15) / (3 / √20)
  • t = (-2) / (0.67082)
  • t = -2.980
  • |t| = 2.980

Using this t-value, she refers to a t-distribution table to locate values based on her significance level of 0.05 and her t-value of 2.980. She uses a sample size of 20 and subtracts 1 to get the degrees of freedom:

  • 20 - 1 = 19

She then reviews her t-value of 2.980, which falls between the levels 0.005 and 0.001 on a t-distribution table. She averages 0.005 and 0.001 to get a value of 0.003. With a two-tailed test, she multiplies this value by 2 to get 0.006, which is the p-value for this test. Since the p-value is less than the 0.05 significance level, she rejects the null hypothesis and accepts the alternative hypothesis that the average number of hours students study each week is not 15 hours.

Using Statistical Software to Find p-value

P-Values can be calculated using p-value tables, spreadsheets, or statistical software like R or SPSS. we can find out how often the test statistic falls under the null hypothesis by using the test statistic and degrees of freedom (number of observations minus the number of independent variables).

The method to calculate a p-value depends on the statistical test you're using. Different statistical tests have different assumptions and produce different statistics. Choose the test method that best fits our data and the effect or relationship you're testing. The number of independent variables in our test affects the size of the test statistic needed to produce the same p-value.

No matter what statistical test we use, the p-value always indicates how often we can expect to get a test statistic as extreme or more extreme than the one from our test.

Practical Applications of p-value

P-Value is important in many engineering fields, from electrical engineering to civil engineering. It helps test prototype reliability, validate experiment results, and optimize systems, supporting statistically-informed decisions.

  • Electrical Engineering: Electrical engineers use P-Values to test the efficiency of electrical devices, compare different models' performance, and validate results from complex circuit simulations.
  • Civil Engineering: In civil engineering, P-Values help validate the strength of construction materials, assess new design methods' effectiveness, and analyze various structural designs' safety.

Next Article
How to Find p Value from Test Statistic

A

amitabhgarg
Improve
Article Tags :
  • Mathematics
  • Math-Statistics

Similar Reads

    How to Find a P-Value from a t-Score in Python?
    In the realm of statistical analysis, the p-value stands as a pivotal metric, guiding researchers in drawing meaningful conclusions from their data. This article delves into the significance and computation of p-values in Python, focusing on the t-test, a fundamental statistical tool. Table of Conte
    10 min read
    How to Extract the p-value and F-statistic from aov Output in R
    In statistical analysis, the analysis of variance (ANOVA) is widely used to test if there are significant differences between the means of multiple groups. In R, the aov() function performs ANOVA, and the summary output includes important values like the F-statistic and p-value. These values help de
    3 min read
    How to Find a P-Value from a Z-Score in Python?
    The p-value in statistics is the likelihood of getting outcomes at least as significant as the observed results of a statistical hypothesis test, given the null hypothesis is true. The p-value, rather than rejection points, is used to determine the least level of significance at which the null hypot
    2 min read
    How to Calculate Test Statistic
    In statistical hypothesis testing, a test statistic is a crucial tool used to determine the validity of the hypothesis about a population parameter. This article delves into the calculation of test statistics exploring its importance in hypothesis testing and its application in real-world scenarios.
    7 min read
    T-Test in Statistics: Formula, Types and Steps
    T-Test is a method used in statistics to determine if there is a significant difference between the means of two groups and how they are related. In T-Test statistics, the sample data is a subset of the two groups that we use to draw conclusions about the groups as a whole. T-Test in StatisticsFor e
    14 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