Z-Test ------- The z-test is used to assess if the mean :math:`\overline{x}` of sample :math:`X` significantly differ from the one of a known population. The *significance level* is determined by a *p-value* threshold chosen prior doing the test. Conditions for using a z-test: #. Population is normally distributed #. Population :math:`\mu` and :math:`\sigma` is known #. Sample size is greater than 30 (see note below) .. note:: According to central limit theorem, a distribution is well approximated when reaching 30 samples. See `here `__ for more infos. To perform a z-test, you should compute the *standard score* (or *z-score*) of your sample. It characterizes how far from the population mean :math:`\mu` your sample mean :math:`\overline{x}` is, in unit of standard deviation :math:`\sigma`. It is computed as follow: .. math:: Z=\frac{\overline{x}-\mu}{\sigma} .. note:: The following formula can also be seen, when the original population :math:`\sigma` is unknown: .. math:: Z=\frac{\overline{x}-\mu}{\mathrm{SEM}}=\frac{\overline{x}-\mu}{\frac{s}{\sqrt{n}}} In this case, :math:`Z` technically follow a t-distribution (student test). However, if :math:`n` is sufficiently large, the distribution followed by :math:`Z` is very close to a normal one. So close that, using z-test in place of the student test to compute *p-values* leads to nominal differences (`source `__). From :math:`Z`, the z-test *p-value* can be derived using the :math:`\mathcal{N}(0,1)` :ref:`CDF `. That *p-value* is computed as follow: * Left "tail" of the :math:`\mathcal{N}(0,1)` distribution: .. math:: \alpha=P(\mathcal{N}(0,1)