~/ learn/ afm-113/ cards/ p-values
1 of 7

Using Φ via math.erf, compute the one-sided and two-sided p-values for z = −1.90, then the two-sided p-value for z = 2.31, printed to four decimals.

Using Φ via math.erf, compute the one-sided and two-sided p-values for z = −1.90, then the two-sided p-value for z = 2.31, printed to four decimals.

Answer

import math def phi(z): return 0.5 * (1 + math.erf(z / math.sqrt(2))) z = -1.90 one = phi(-abs(z)) print(f"p one-sided={one:.4f} p two-sided={2 * one:.4f}") z2 = 2.31 print(f"z={z2} p two-sided={2 * phi(-abs(z2)):.4f}")

IS1 §9.4 (rare-events framing), CC BY 4.0; BCc ch 5 ("the smallest α that rejects"; software prints two-sided); H-W9 — shape only; original dataset

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/4dd32182-8a9d-49d3-b78a-46f2a3dde0a8/flashcard utf-8 LF