For a normal sample of size n with sample variance s², the number (n − 1)s²/σ² follows the chi-square curve with n − 1 degrees of freedom (top panel). Cutting off the two tails turns it into a test of H0: σ = σ0 (reject when the statistic is in a pink tail) and, solved for σ², into an interval for σ. The curve is not symmetric, so "2.5% in each tail" is a convention: the exact likelihood ratio test, the unbiased test and the shortest interval all use unequal tails. The middle panel is the power curve of the test and the bottom panel the expected width of the interval as n grows.
Every number is computed exactly (no simulation). The exact likelihood ratio cut-offs solve ae−a/n = be−b/n with total tail area α; the unbiased test has the same height of the χ²n+1 density at a and b; the shortest interval for σ² has equal height of χ²n+3 (all in the lecture notes). The P-value shown is the equal-tailed convention (twice the smaller tail area for the two-sided test). For one-sided alternatives only the equal-tailed cut-off is used.
code/ch07_normal_inference.py (var_interval, var_test, glrt_cutoffs, unbiased_cutoffs, shortest_interval_cutoffs, expected_width_ratio, chi2_power).