Skip to content

Commit

Permalink
Updated difference_test and ttest documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey-Bryant committed Mar 10, 2022
1 parent fde503e commit 7683b7d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
37 changes: 28 additions & 9 deletions source/difference_test_documentation.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*****************
difference_test()
=================
*****************

Description
============
Conducts a few different statistical tests which test for a difference between
independent or related samples with or without equal variances and has the ability
to calculate the effect size of the observed difference. The data is
Expand All @@ -22,21 +26,26 @@ This method can perform the following tests:

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

* Wilcoxon ranked-sign test :cite:`2018:scipy_wilcoxon`
* Wilcoxon signed-rank 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)`

2 objects will be returned for all available tests; the first object will be a
2 objects will be returned for all available tests except for the Wilcoxon signed-rank test; the first object will be a
descriptive summary table and the second will be the testing result information which
will include the effect size measures if indicated.

For the Wilcoxon signed-rank test, 3 objects will be returned. The first object
provides descriptive information regarding the ranks, the second object contains the adjustment information,
and the third object contains the test results.



Parameters
==========

Arguments
-----------------
Input
-----
**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".
Expand All @@ -47,14 +56,24 @@ Arguments
* **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)**

* **return_type**: Specify if the results should be returned as a Pandas DataFrame (default) or a Python dictionary (= 'Dictionary').
* **effect_size**: Specify if effect sizes should be calculated, default value is None.
* Available options are: None, "Cohen's D", "Hedge's G", "Glass's delta1", "Glass's delta2", "r", and/or "all".
Returns
-------
Returns an object with class "difference_test"; this object has accessible methods which are described below.

difference_test methods
^^^^^^^^^^^^^^^^^^^^^^^

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

* **return_type**: Specify if the results should be returned as a Pandas DataFrame (default) or a Python dictionary (= 'Dictionary').
* **effect_size**: Specify if effect sizes should be calculated, default value is None.
* Available options are: None, "Cohen's D", "Hedge's G", "Glass's delta1", "Glass's delta2", "r", and/or "all".
* User can specify any combination of effect sizes, or use "all" which will calculate all effect sizes.
* Only effect size "r" is supported for the Wilcoxon ranked-sign test.
* **decimals** : The number of decimal places the data should be rounded too.

:note: If



Expand Down
14 changes: 5 additions & 9 deletions source/ttest_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This method can perform the following tests:

* `psudo-code: ttest(group1, group2, equal_variances = False, paired = False)`

* Wilcoxon ranked-sign test :cite:p:`scipy_wilcoxon`
* Wilcoxon signed-rank test :cite:p:`scipy_wilcoxon`

* `psudo-code: ttest(group1, group2, equal_variances = False, paired = True)`

Expand All @@ -41,14 +41,10 @@ Input
-----
**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
* **equal_variances** : tells whether equal variances is assumed or not.
If not, Welch's t-test is used if data is unpaired, or Wilcoxon
rank-signed test is used if data is paired. The default is True.
* **paired** : tells whether the data is paired. If data is paired and equal
variance is assumed, a paired sample t-test is conducted, otherwise a Wilcoxon
ranked-sign test is conducted. The default is False.
* **group1** and **group2** : Requires the data to be a Pandas Series.
* **group1_name** and **group2_name** : Will override the series name.
* **equal_variances** : Tells whether equal variances is assumed or not. If equal variances are not assumed and the data is unpaired, then the Welch's t-test will be conducted using Satterthwaite or Welch degrees of freedom (default is Satterthwaite).
* **paired** : Tells whether the data are paired. If the data is paired and equal variances are assumed then a paired sample t-test will be conducted. If the data is paired and equal variances are not assumed then a Wilcoxon signed-rank test will be conducted.
* **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).

Expand Down

0 comments on commit 7683b7d

Please sign in to comment.