48 lines
1.8 KiB
ReStructuredText
48 lines
1.8 KiB
ReStructuredText
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.
|
|
|
|
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 <https://statisticsbyjim.com/basics/central-limit-theorem/>`__ for more infos.
|
|
|
|
One-tailed vs Two-tailed
|
|
========================
|
|
|
|
|
|
To perform a z-test, you should compute the *standard score* (or *z-score*) of your sample.
|
|
It corresponds to the projection of the sample mean :math:`\overline{x}` under the original population distribution.
|
|
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}}}
|
|
|
|
This formula originate from the t-test and :math:`Z` technically follow a t-distribution.
|
|
However, if :math:`n` is sufficiently large, the sample distribution is very close to a normal one.
|
|
So close that, using the normal in place of the student-t to compute p values leads to nominal differences (`source <https://stats.stackexchange.com/questions/625578/why-is-the-sample-standard-deviation-used-in-the-z-test>`__).
|
|
|
|
|
|
|
|
One tailed two tailed:
|
|
https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faq-what-are-the-differences-between-one-tailed-and-two-tailed-tests/
|
|
|
|
example 2 tailed https://www.mathandstatistics.com/learn-stats/hypothesis-testing/two-tailed-z-test-hypothesis-test-by-hand
|
|
|
|
|
|
|
|
Examples
|
|
========
|