Skip to content

Commit ac89707

Browse files
committed
Updated difference_test, ttest, and anova documentation
Updated difference_test, ttest, and anova documentation. Also trying to get the citations to only show those which were cited.
1 parent 9b3cd2f commit ac89707

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

source/anova_documentation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ anova methods
3030
^^^^^^^^^^^^^
3131

3232
* **results(return_type = "Dataframe", decimals = 4, pretty_format = True)**
33+
3334
* **return_type** : The type of data structure the results should be returned as. Supported options
3435
are 'Dataframe' which will return a Pandas DataFrame or 'Dictionary' which will return a dictionary.
3536
* **decimals** : The number of decimal places the data should be rounded too.

source/difference_test_documentation.rst

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ This method is similar to researchpy.ttest(), except it allows the user to use
1010
the formula syntax.
1111

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

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

17-
* Paired sample t-test :cite:`scipy_ttest_rel`
17+
* Paired sample t-test :cite:`2018:scipy_ttest_rel`
1818

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

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

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

25-
* Wilcoxon ranked-sign test :cite:`scipy_wilcoxon`
25+
* Wilcoxon ranked-sign test :cite:`2018:scipy_wilcoxon`
2626

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

3838
Arguments
3939
-----------------
40-
**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)**
40+
**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)**
4141

4242
* **formula_like**: A valid `formula <https://patsy.readthedocs.io/en/latest/formulas.html>`_ ; for example, "DV ~ IV".
4343
* **data**: data to perform the analysis on - contains the dependent and independent variables.
4444
* **conf_level**: Specify the confidence interval to be calculated.
4545
* **equal_variances**: Boolean to indicate if equal variances are assumed.
4646
* **independent_samples**: Boolean to indicate if groups and independent of each other.
4747
* **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>`_.
48+
* **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".
4849

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

@@ -84,6 +85,25 @@ Arguments
8485
8586
8687
88+
Welch Degrees of freedom
89+
^^^^^^^^^^^^^^^^^^^^^^^^
90+
There are two degrees of freedom options available when calculating the Welch's t-test. The default is to use
91+
the Satterthwaite :cite:`1946:Satterthwaite` calculation with the option to use the Welch :cite:`1947:Welch` calculation.
92+
93+
Satterthwaite (1946)
94+
""""""""""""""""""""
95+
96+
.. math::
97+
98+
\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} }
99+
100+
101+
Welch (1947)
102+
""""""""""""
103+
104+
.. math::
105+
106+
-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
87107
88108
89109
Effect size measures formulas
@@ -445,4 +465,3 @@ References
445465
----------
446466
.. bibliography:: refs.bib
447467
:list: bullet
448-
:cited:

source/refs.bib

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
% Encoding: UTF-8
22
3+
@Article{Satterthwaite,
4+
ISSN = {00994987},
5+
URL = {http://www.jstor.org/stable/3002019},
6+
author = {F. E. Satterthwaite},
7+
journal = {Biometrics Bulletin},
8+
number = {6},
9+
pages = {110--114},
10+
publisher = {[International Biometric Society, Wiley]},
11+
title = {An Approximate Distribution of Estimates of Variance Components},
12+
volume = {2},
13+
year = {1946}
14+
}
15+
16+
@Article{Welch,
17+
ISSN = {00063444},
18+
URL = {http://www.jstor.org/stable/2332510},
19+
author = {B. L. Welch},
20+
journal = {Biometrika},
21+
number = {1/2},
22+
pages = {28--35},
23+
publisher = {[Oxford University Press, Biometrika Trust]},
24+
title = {The Generalization of `Student's' Problem when Several Different Population Variances are Involved},
25+
volume = {34},
26+
year = {1947}
27+
}
28+
29+
330
@Book{cohen1988,
431
title = {Statistical Power Analysis for the Behavioral Sciences},
532
publisher = {Lawrence Erlbaum Associates},

source/ttest_documentation.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Parameters
3939

4040
Input
4141
-----
42-
**ttest(group1, group2, group1_name= None, group2_name= None, equal_variances= True, paired= False, wilcox_parameters = {"zero_method" : "pratt", "correction" : False, "mode" : "auto"})**
42+
**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")**
4343

4444
* **group1** and **group2** : requires the data to be a Pandas Series
4545
* **group1_name** and **group2_name** : will override the series name
@@ -50,6 +50,7 @@ Input
5050
variance is assumed, a paired sample t-test is conducted, otherwise a Wilcoxon
5151
ranked-sign test is conducted. The default is False.
5252
* **wilcox_parameters** : A dictionary which contains the testing specifications for the Wilcoxon signed-rank test.
53+
* **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).
5354

5455

5556
Returns
@@ -82,6 +83,28 @@ effect size measures of Pearson r and Rank-Biserial r.
8283

8384

8485

86+
Welch Degrees of freedom
87+
========================
88+
There are two degrees of freedom options available when calculating the Welch's t-test. The default is to use
89+
the Satterthwaite (1946) calculation with the option to use the Welch (1947) calculation.
90+
91+
Satterthwaite (1946)
92+
^^^^^^^^^^^^^^^^^^^^
93+
94+
.. math::
95+
96+
\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} }
97+
98+
99+
Welch (1947)
100+
^^^^^^^^^^^^
101+
102+
.. math::
103+
104+
-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} }
105+
106+
107+
85108
Effect size measures formulas
86109
=============================
87110

0 commit comments

Comments
 (0)