Skip to content

Commit

Permalink
Updated difference_test, ttest, and anova documentation
Browse files Browse the repository at this point in the history
Updated difference_test, ttest, and anova documentation.

Also trying to get the citations to only show those which were cited.
  • Loading branch information
Corey-Bryant committed Jan 14, 2022
1 parent 9b3cd2f commit ac89707
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 7 deletions.
1 change: 1 addition & 0 deletions source/anova_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ anova methods
^^^^^^^^^^^^^

* **results(return_type = "Dataframe", decimals = 4, pretty_format = True)**

* **return_type** : The type of data structure the results should be returned as. Supported options
are 'Dataframe' which will return a Pandas DataFrame or 'Dictionary' which will return a dictionary.
* **decimals** : The number of decimal places the data should be rounded too.
Expand Down
31 changes: 25 additions & 6 deletions source/difference_test_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ This method is similar to researchpy.ttest(), except it allows the user to use
the formula syntax.

This method can perform the following tests:
* Independent sample t-test :cite:`scipy_ttest_ind`
* Independent sample t-test :cite:`2018:scipy_ttest_ind`

* `psudo-code: difference_test(formula_like, data, equal_variances = True, independent_samples = True)`

* Paired sample t-test :cite:`scipy_ttest_rel`
* Paired sample t-test :cite:`2018:scipy_ttest_rel`

* `psudo-code: difference_test(formula_like, data, equal_variances = True, independent_samples = False)`

* Welch's t-test :cite:`scipy_ttest_ind`
* Welch's t-test :cite:`2018:scipy_ttest_ind`

* `psudo-code: difference_test(formula_like, data, equal_variances = False, independent_samples = True)`

* Wilcoxon ranked-sign test :cite:`scipy_wilcoxon`
* Wilcoxon ranked-sign test :cite:`2018:scipy_wilcoxon`

* By default, discards all zero-differences; this is known as the 'wilcox' method.
* `psudo-code: difference_test(formula_like, data, equal_variances = False, independent_samples = False)`
Expand All @@ -37,14 +37,15 @@ will include the effect size measures if indicated.

Arguments
-----------------
**difference_test(formula_like, data = {}, conf_level = 0.95, equal_variances = True, independent_samples = True, wilcox_parameters = {"zero_method" : "wilcox", "correction" : False, "mode" : "auto"}, **keywords)**
**difference_test(formula_like, data = {}, conf_level = 0.95, equal_variances = True, independent_samples = True, wilcox_parameters = {"zero_method" : "wilcox", "correction" : False, "mode" : "auto"}, welch_dof = "satterthwaite", **keywords)**

* **formula_like**: A valid `formula <https://patsy.readthedocs.io/en/latest/formulas.html>`_ ; for example, "DV ~ IV".
* **data**: data to perform the analysis on - contains the dependent and independent variables.
* **conf_level**: Specify the confidence interval to be calculated.
* **equal_variances**: Boolean to indicate if equal variances are assumed.
* **independent_samples**: Boolean to indicate if groups and independent of each other.
* **wilcox_parameters**: A dictionary with optional methods for calculating the Wilcoxon signed-rank test. For more information, see `scipy.stats.wilcoxon <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon>`_.
* **welch_dof** : A string which indicates how to calculate the degrees of freedom for the Welch's t-test; options are "satterthwaite" (default) and "welch".

**conduct(return_type = "Dataframe", effect_size = None)**

Expand Down Expand Up @@ -84,6 +85,25 @@ Arguments
Welch Degrees of freedom
^^^^^^^^^^^^^^^^^^^^^^^^
There are two degrees of freedom options available when calculating the Welch's t-test. The default is to use
the Satterthwaite :cite:`1946:Satterthwaite` calculation with the option to use the Welch :cite:`1947:Welch` calculation.

Satterthwaite (1946)
""""""""""""""""""""

.. math::
\frac{(\frac{s^2_x}{n_x} + \frac{s^2_y}{n_y})^2}{\frac{(\frac{s^2_x}{n_x})^2}{n_x-1} + \frac{(\frac{s^2_y}{n_y})^2}{n_y-1} }
Welch (1947)
""""""""""""

.. math::
-2 + \frac{(\frac{s^2_x}{n_x} + \frac{s^2_y}{n_y})^2}{\frac{(\frac{s^2_x}{n_x})^2}{n_x+1} + \frac{(\frac{s^2_y}{n_y})^2}{n_y+1
Effect size measures formulas
Expand Down Expand Up @@ -445,4 +465,3 @@ References
----------
.. bibliography:: refs.bib
:list: bullet
:cited:
27 changes: 27 additions & 0 deletions source/refs.bib
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
% Encoding: UTF-8
@Article{Satterthwaite,
ISSN = {00994987},
URL = {http://www.jstor.org/stable/3002019},
author = {F. E. Satterthwaite},
journal = {Biometrics Bulletin},
number = {6},
pages = {110--114},
publisher = {[International Biometric Society, Wiley]},
title = {An Approximate Distribution of Estimates of Variance Components},
volume = {2},
year = {1946}
}

@Article{Welch,
ISSN = {00063444},
URL = {http://www.jstor.org/stable/2332510},
author = {B. L. Welch},
journal = {Biometrika},
number = {1/2},
pages = {28--35},
publisher = {[Oxford University Press, Biometrika Trust]},
title = {The Generalization of `Student's' Problem when Several Different Population Variances are Involved},
volume = {34},
year = {1947}
}


@Book{cohen1988,
title = {Statistical Power Analysis for the Behavioral Sciences},
publisher = {Lawrence Erlbaum Associates},
Expand Down
25 changes: 24 additions & 1 deletion source/ttest_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Parameters

Input
-----
**ttest(group1, group2, group1_name= None, group2_name= None, equal_variances= True, paired= False, wilcox_parameters = {"zero_method" : "pratt", "correction" : False, "mode" : "auto"})**
**ttest(group1, group2, group1_name= None, group2_name= None, equal_variances= True, paired= False, wilcox_parameters = {"zero_method" : "pratt", "correction" : False, "mode" : "auto"}, welch_dof = "satterthwaite")**

* **group1** and **group2** : requires the data to be a Pandas Series
* **group1_name** and **group2_name** : will override the series name
Expand All @@ -50,6 +50,7 @@ Input
variance is assumed, a paired sample t-test is conducted, otherwise a Wilcoxon
ranked-sign test is conducted. The default is False.
* **wilcox_parameters** : A dictionary which contains the testing specifications for the Wilcoxon signed-rank test.
* **welch_dof** : A string to indicate which calculation is to be used when calculating the degrees of freedom. Can either be "welch" or "satterthwaite" (default).


Returns
Expand Down Expand Up @@ -82,6 +83,28 @@ effect size measures of Pearson r and Rank-Biserial r.



Welch Degrees of freedom
========================
There are two degrees of freedom options available when calculating the Welch's t-test. The default is to use
the Satterthwaite (1946) calculation with the option to use the Welch (1947) calculation.

Satterthwaite (1946)
^^^^^^^^^^^^^^^^^^^^

.. math::
\frac{(\frac{s^2_x}{n_x} + \frac{s^2_y}{n_y})^2}{\frac{(\frac{s^2_x}{n_x})^2}{n_x-1} + \frac{(\frac{s^2_y}{n_y})^2}{n_y-1} }
Welch (1947)
^^^^^^^^^^^^

.. math::
-2 + \frac{(\frac{s^2_x}{n_x} + \frac{s^2_y}{n_y})^2}{\frac{(\frac{s^2_x}{n_x})^2}{n_x+1} + \frac{(\frac{s^2_y}{n_y})^2}{n_y+1} }
Effect size measures formulas
=============================

Expand Down

0 comments on commit ac89707

Please sign in to comment.