š How to Calculate P-Values (And Why It's Kind of Fun!)

Note: This blog assumes you already know what a p-value is and how to interpret it. If not, check out my previous technical blog or LinkedIn post before diving in.
⨠Introduction
Calculating p-values may sound intimidating at first, but once you understand the mechanics, itās actually a fascinating (and even fun!) process. It involves logic, distribution theory, and a pinch of probability intuition. Letās break it down.
š What Is a P-Value (Technically)?
At its core, a p-value is composed of three parts:
š The probability that random chance would result in the observed outcome.
š The probability of observing something else thatās equally rare.
š The probability of observing something rarer or more extreme.
Together, these define how surprising or āunlikelyā your data is, assuming the null hypothesis is true.
š P-Values for Continuous Data
When dealing with continuous data (like heights, weights, or income), p-values are calculated by evaluating the tail(s) of a probability distribution. You:
Determine the observed test statistic.
Compare it to the theoretical distribution (e.g., normal, t, chi-square).
Calculate the area under the curve that lies beyond the observed value (or symmetrically on both sides for two-tailed tests).
ā ļø Borderline P-Values
A borderline p-value (like 0.049 or 0.051) lies right on the edge of the common 0.05 threshold. These are tricky. They may suggest possible significance, but you should avoid over-interpreting them. Always consider the broader context and your studyās design.
ā Significant P-Values
Typically, a p-value < 0.05 is considered significant. It implies that your observed result is unlikely to have occurred due to random chance alone. However, āsignificantā doesnāt always mean āimportantāākeep that in mind!
ā Insignificant P-Values
A p-value > 0.05 means the data doesnāt provide strong enough evidence to reject the null hypothesis. But that doesnāt confirm the null is trueāit just means we donāt have enough evidence against it.
āļø One-Sided vs Two-Sided P-Values
Before calculating anything, you need to choose your test direction:
Two-Sided p-values test for any deviation from the null (higher or lower).
š Most commonly used.
One-Sided p-values test for deviation in a specific direction only.
ā ļø Use with cautionāthey can be misleading if misapplied.
In this blog, weāre focusing on the more robust and widely accepted two-sided p-values.
š§ Why Include āEqually Rareā or āMore Extremeā?
Great question.
In hypothesis testing, weāre not just interested in the observed resultāweāre interested in how likely it is to observe something like it or even more surprising under the assumption that the null hypothesis is true. Thatās why we account for:
Equally rare events: Those that have the same probability as your result.
More extreme events: Those that are less likely under the null distribution.
This gives the p-value its full meaning.
š§¾ Summary
Hereās the essence of calculating p-values:
Itās not just the chance of your result.
Itās the sum of your result, equally rare ones, and more extreme possibilities.
Itās built on understanding the shape of the distribution and identifying tail areas.
Two-sided p-values are the standard; one-sided ones are riskier and less common.
š Calculating p-values is kinda fun...
... and not just when you're done!
Subscribe to my newsletter
Read articles from Ashutosh Kurwade directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
