diff --git a/source/index.rst b/source/index.rst index 4c84436..4578515 100644 --- a/source/index.rst +++ b/source/index.rst @@ -18,10 +18,7 @@ Welcome to ScienceNotes's documentation! statistics/probability_distribution_functions.rst statistics/distributions/index.rst - statistics/tests_parametric/index.rst - statistics/tests_non_parametric/index.rst - - + statistics/tests/index.rst Indices and tables diff --git a/source/statistics/tests/index.rst b/source/statistics/tests/index.rst new file mode 100644 index 0000000..c285f40 --- /dev/null +++ b/source/statistics/tests/index.rst @@ -0,0 +1,32 @@ +Statistical Tests +------------------ + + +Statistical tests are used to decide whether a hypotesis is true or not. To do so, two hypothesis must be formulated: + +#. :math:`H_0` : The one that is true at first glance (nothing particular, null, boring): + + - The mean of two populations are equals + - The average weight of the children in that school is not different from the one of the country + +#. :math:`H_1` : The one that says: "Something strange is happening" + + - The mean of two populations are differents + - The average weight of the children in that school differ from the one of the country + + +A statistical test usually works with a **p-value** noted :math:`\alpha`. +It corresponds to the probability of obtaining the results that you have under the assumption that the null hypothesis is correct. +In other words, how lucky you are of obtaining these results. + +Prior performing a statistical test, you must choose a minimal *p-value*. +:math:`H_0` will be rejected (meaning :math:`H_1` considered true) if the *p-value* obtained from the statistical test +is lower or equal to the one you choose initially. +The lower your initial *p-value* is, the more difficult it is to reject the null hypothesis. + +.. toctree:: + :maxdepth: 2 + :caption: Categories + + parametric/index + non-parametric/index diff --git a/source/statistics/tests_non_parametric/index.rst b/source/statistics/tests/non-parametric/index.rst similarity index 100% rename from source/statistics/tests_non_parametric/index.rst rename to source/statistics/tests/non-parametric/index.rst diff --git a/source/statistics/tests_parametric/index.rst b/source/statistics/tests/parametric/index.rst similarity index 62% rename from source/statistics/tests_parametric/index.rst rename to source/statistics/tests/parametric/index.rst index 713047f..61a9906 100644 --- a/source/statistics/tests_parametric/index.rst +++ b/source/statistics/tests/parametric/index.rst @@ -2,8 +2,8 @@ Parametric Tests ----------------- .. toctree:: - :maxdepth: 2 - :caption: Statistics + :maxdepth: 1 - ttest ztest + ttest + diff --git a/source/statistics/tests_parametric/ttest.rst b/source/statistics/tests/parametric/ttest.rst similarity index 100% rename from source/statistics/tests_parametric/ttest.rst rename to source/statistics/tests/parametric/ttest.rst diff --git a/source/statistics/tests/parametric/ztest.rst b/source/statistics/tests/parametric/ztest.rst new file mode 100644 index 0000000..82c3586 --- /dev/null +++ b/source/statistics/tests/parametric/ztest.rst @@ -0,0 +1,48 @@ +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 `__ 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 `__). + + + +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 +======== diff --git a/source/statistics/tests_parametric/ztest.rst b/source/statistics/tests_parametric/ztest.rst deleted file mode 100644 index df18b7e..0000000 --- a/source/statistics/tests_parametric/ztest.rst +++ /dev/null @@ -1,7 +0,0 @@ -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