liveBook · Manning

Critical range

As explained in Grokking Statistics

The interval of test-statistic values that is not sufficiently extreme to reject the null hypothesis.

A critical range is the central interval of test-statistic values that is not extreme enough to reject the null hypothesis. In a two-tailed test with 95% confidence, the standard-normal critical range is approximately [-1.959964, 1.959964]. Values outside it fall in the alpha regions and count as statistically significant. section 6.6

Potato-chip bag weights

Testing the claim that bags average 142 grams produces a Z-statistic of -2.4062. Because it falls outside [-1.959964, 1.959964], reject the null hypothesis: the sample provides enough evidence that the mean differs from 142 grams. section 6.6

from math import sqrt  #1
from scipy.stats import norm  #1

mu = 142.0 #2
n = 41  #3
x_bar = 140.2  #4
s = 4.79 #5
alpha = 0.05  #6

z_stat = (x_bar - mu) / (s / sqrt(n)) #7

critical_z = norm.ppf(1 - (alpha / 2)) #8

print("Population mean: ", mu) #9
print("Sample mean: ", x_bar) #9
print("Sample standard deviation: ", s) #9
print("Sample size: ", n) #9
print("Level of confidence: ", 1 - alpha) #9
print("Level of significance: ", alpha) #9
print("z-statistic: ", z_stat) #9
print("Critical value: ", critical_z) #9

if -critical_z <= z_stat <= critical_z: #10
    print("Decision: Fail to reject the null hypothesis. "
          "The sample does not provide enough evidence the mean is different.") #11
else:
    print("Decision: Reject the null hypothesis. "
          "The sample provides enough evidence the mean is different.") #11
"""
Population mean:  142.0
Sample mean:  140.2
Sample standard deviation:  4.79
Sample size:  41
Level of confidence:  0.95
Level of significance:  0.05
z-statistic:  -2.4061844733568267
Critical value:  1.959963984540054
Decision: Reject the null hypothesis. The sample provides enough evidence the
    mean is different
"""

Calculate the Z-statistic and two-tailed critical value in Python, then compare the statistic with the critical range to make the decision. section 6.6

How Grokking Statistics covers it

How deep it goes
Explains central and tail regions, confidence selection, numerical boundaries, and a Python decision rule without deriving the distribution.
Examples
Uses a 142-gram potato-chip claim, a sample mean of 140.2, and Z-statistic -2.4062.
What it assumes
Assumes basic familiarity with hypothesis testing, confidence levels, significance levels, and Z-statistics.
What you can do after
Apply it via Python and SciPy to compare a Z-statistic with a two-tailed critical value and interpret the decision.
How it connects
Connects critical range with null hypothesis, significance level, Z-statistic, alpha regions, and standard normal distribution.

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.