One-Sample z-Test

easy
Unit 6 · Hypothesis Testing I0/3 to milestone

Test whether a sample mean differs from a hypothesised μ0\mu_0 when the population standard deviation σ\sigma is known:

z=xˉ−μ0σ/nz = \frac{\bar x - \mu_0}{\sigma/\sqrt n}

Implement z_test(x, mu0, sigma, alternative="two-sided") returning (z, p_value), with alternative in "two-sided", "greater", "less". Use math.erf for the normal CDF.

#hypothesis-testing#statistics2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
One-Sample z-Test · TechGradify