The Z-Test › Computing P-Values from Z-Statistics
Michael BrenndoerferUpdated January 12, 20262 min read
Machine Learning from ScratchAll chapters Part 2 of 9Hypothesis Testing
The Z-Test › Computing P-Values from Z-StatisticsOne section · Sections in this chapter4 / 11 ↓
Sections in this chapter11
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Once you have a z-statistic, you need to convert it to a p-value. The process depends on whether you're doing a one-sided or two-sided test.
Two-Sided Test
For a two-sided test (testing whether the mean differs from in either direction):
where is the standard normal CDF. We double the probability because we're interested in extreme values in both tails.
One-Sided Tests
For a right-tailed test (testing whether the mean is greater than ):
For a left-tailed test (testing whether the mean is less than ):
Out[5]:
Visualization
