Skip to content

Commit fc69b3c

Browse files
authored
Use BibTeX for references and improve docstrings (#86)
* Use BibTeX and enhance docstrings. * Update estimators.py * More improvements.
1 parent 573a226 commit fc69b3c

File tree

10 files changed

+378
-120
lines changed

10 files changed

+378
-120
lines changed

docs/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ API
9191

9292
:template: function.rst
9393
effectsize.solve_system
94-
effectsize.Expression
9594
effectsize.select_expressions
9695
effectsize.compute_measure
9796

docs/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"sphinx_copybutton", # for copying code snippets
5454
"sphinx_gallery.gen_gallery", # example gallery
5555
"sphinxarg.ext", # argparse
56+
"sphinxcontrib.bibtex", # for foot-citations
5657
"recommonmark", # markdown parser
5758
]
5859

@@ -188,6 +189,14 @@
188189
# Generate the plots for the gallery
189190
plot_gallery = True
190191

192+
# -----------------------------------------------------------------------------
193+
# sphinxcontrib-bibtex
194+
# -----------------------------------------------------------------------------
195+
bibtex_bibfiles = ["./references.bib"]
196+
bibtex_style = "unsrt"
197+
bibtex_reference_style = "author_year"
198+
bibtex_footbibliography_header = ""
199+
191200

192201
def setup(app):
193202
"""From https://github.com/rtfd/sphinx_rtd_theme/issues/117."""

docs/references.bib

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
@article{brockwell2001comparison,
2+
title={A comparison of statistical methods for meta-analysis},
3+
author={Brockwell, Sarah E and Gordon, Ian R},
4+
journal={Statistics in medicine},
5+
volume={20},
6+
number={6},
7+
pages={825--840},
8+
year={2001},
9+
publisher={Wiley Online Library},
10+
url={https://doi.org/10.1002/sim.650},
11+
doi={10.1002/sim.650}
12+
}
13+
14+
@article{cochran1954combination,
15+
title={The combination of estimates from different experiments},
16+
author={Cochran, William G},
17+
journal={Biometrics},
18+
volume={10},
19+
number={1},
20+
pages={101--129},
21+
year={1954},
22+
publisher={JSTOR}
23+
}
24+
25+
@article{dersimonian1986meta,
26+
title={Meta-analysis in clinical trials},
27+
author={DerSimonian, Rebecca and Laird, Nan},
28+
journal={Controlled clinical trials},
29+
volume={7},
30+
number={3},
31+
pages={177--188},
32+
year={1986},
33+
publisher={Elsevier},
34+
url={https://doi.org/10.1093/biomet/asx001},
35+
doi={10.1093/biomet/asx001}
36+
}
37+
38+
@article{fisher1946statistical,
39+
title={Statistical methods for research workers.},
40+
author={Fisher, Ronald Aylmer and others},
41+
journal={Statistical methods for research workers.},
42+
number={10th. ed.},
43+
year={1946},
44+
publisher={Oliver and Boyd}
45+
}
46+
47+
@book{hedges2014statistical,
48+
title={Statistical methods for meta-analysis},
49+
author={Hedges, Larry V and Olkin, Ingram},
50+
year={2014},
51+
publisher={Academic press}
52+
}
53+
54+
@article{higgins2002quantifying,
55+
title={Quantifying heterogeneity in a meta-analysis},
56+
author={Higgins, Julian PT and Thompson, Simon G},
57+
journal={Statistics in medicine},
58+
volume={21},
59+
number={11},
60+
pages={1539--1558},
61+
year={2002},
62+
publisher={Wiley Online Library}
63+
}
64+
65+
@article{kosmidis2017improving,
66+
title={Improving the accuracy of likelihood-based inference in meta-analysis and meta-regression},
67+
author={Kosmidis, Ioannis and Guolo, Annamaria and Varin, Cristiano},
68+
journal={Biometrika},
69+
volume={104},
70+
number={2},
71+
pages={489--496},
72+
year={2017},
73+
publisher={Oxford University Press},
74+
url={https://doi.org/10.1093/biomet/asx001},
75+
doi={10.1093/biomet/asx001}
76+
}
77+
78+
@article{sangnawakij2019meta,
79+
title={Meta-analysis without study-specific variance information: Heterogeneity case},
80+
author={Sangnawakij, Patarawan and B{\"o}hning, Dankmar and Niwitpong, Sa-Aat and Adams, Stephen and Stanton, Michael and Holling, Heinz},
81+
journal={Statistical Methods in Medical Research},
82+
volume={28},
83+
number={1},
84+
pages={196--210},
85+
year={2019},
86+
publisher={SAGE Publications Sage UK: London, England},
87+
url={https://doi.org/10.1177/0962280217718867},
88+
doi={10.1177/0962280217718867}
89+
}
90+
91+
@article{stouffer1949american,
92+
title={The american soldier: Adjustment during army life.(studies in social psychology in world war ii), vol. 1},
93+
author={Stouffer, Samuel A and Suchman, Edward A and DeVinney, Leland C and Star, Shirley A and Williams Jr, Robin M},
94+
journal={Studies in social psychology in World War II},
95+
year={1949},
96+
publisher={Princeton Univ. Press}
97+
}
98+
99+
@article{veroniki2016methods,
100+
title={Methods to estimate the between-study variance and its uncertainty in meta-analysis},
101+
author={Veroniki, Areti Angeliki and Jackson, Dan and Viechtbauer, Wolfgang and Bender, Ralf and Bowden, Jack and Knapp, Guido and Kuss, Oliver and Higgins, Julian PT and Langan, Dean and Salanti, Georgia},
102+
journal={Research synthesis methods},
103+
volume={7},
104+
number={1},
105+
pages={55--79},
106+
year={2016},
107+
publisher={Wiley Online Library},
108+
url={https://doi.org/10.1002/jrsm.1164},
109+
doi={10.1002/jrsm.1164}
110+
}
111+
112+
@article{viechtbauer2007confidence,
113+
title={Confidence intervals for the amount of heterogeneity in meta-analysis},
114+
author={Viechtbauer, Wolfgang},
115+
journal={Statistics in medicine},
116+
volume={26},
117+
number={1},
118+
pages={37--52},
119+
year={2007},
120+
publisher={Wiley Online Library},
121+
url={https://doi.org/10.1002/sim.2514},
122+
doi={10.1002/sim.2514}
123+
}
124+
125+
@article{winkler2016non,
126+
title={Non-parametric combination and related permutation tests for neuroimaging},
127+
author={Winkler, Anderson M and Webster, Matthew A and Brooks, Jonathan C and Tracey, Irene and Smith, Stephen M and Nichols, Thomas E},
128+
journal={Human brain mapping},
129+
volume={37},
130+
number={4},
131+
pages={1486--1511},
132+
year={2016},
133+
publisher={Wiley Online Library},
134+
url={https://doi.org/10.1002/hbm.23115},
135+
doi={10.1002/hbm.23115}
136+
}

pymare/core.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,34 @@ class Dataset:
2424
y : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
2525
1d array of study-level estimates with length K, or the name of the column in data
2626
containing the y values.
27-
Default is None.
27+
Default = None.
2828
v : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
2929
1d array of study-level variances with length K, or the name of the column in data
3030
containing v values.
31-
Default is None.
31+
Default = None.
3232
X : None or :obj:`numpy.ndarray` of shape (K,[P]) or :obj:`list` of :obj:`str`, optional
3333
1d or 2d array containing study-level predictors (dimensions K x P),
3434
or a list of strings giving the names of the columns in data containing the X values.
35-
Default is None.
35+
Default = None.
3636
n : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
3737
1d array of study-level sample sizes (length K), or the name of the corresponding column
3838
in ``data``.
39-
Default is None.
39+
Default = None.
4040
data : None or :obj:`pandas.DataFrame`, optional
4141
A pandas DataFrame containing y, v, X, and/or n values.
4242
By default, columns are expected to have the same names as arguments
4343
(e.g., the y values will be expected in the 'y' column).
4444
This can be modified by passing strings giving column names to any of the ``y``, ``v``,
4545
``X``, or ``n`` arguments.
46-
Default is None.
46+
Default = None.
4747
X_names : None or :obj:`list` of :obj:`str`, optional
4848
List of length P containing the names of the predictors.
4949
Ignored if ``data`` is provided (use ``X`` to specify columns).
50-
Default is None.
50+
Default = None.
5151
add_intercept : :obj:`bool`, optional
5252
If True, an intercept column is automatically added to the predictor matrix.
5353
If False, the predictors matrix is passed as-is to estimators.
54-
Default is True.
54+
Default = True.
5555
"""
5656

5757
def __init__(
@@ -114,19 +114,19 @@ def meta_regression(
114114
y : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
115115
1d array of study-level estimates with length K, or the name of the column in data
116116
containing the y values.
117-
Default is None.
117+
Default = None.
118118
v : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
119119
1d array of study-level variances with length K, or the name of the column in data
120120
containing v values.
121-
Default is None.
121+
Default = None.
122122
X : None or :obj:`numpy.ndarray` of shape (K,[P]) or :obj:`list` of :obj:`str`, optional
123123
1d or 2d array containing study-level predictors (dimensions K x P),
124124
or a list of strings giving the names of the columns in data containing the X values.
125-
Default is None.
125+
Default = None.
126126
n : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
127127
1d array of study-level sample sizes (length K), or the name of the corresponding column
128128
in ``data``.
129-
Default is None.
129+
Default = None.
130130
data : None or :obj:`pandas.DataFrame` or :obj:`~pymare.core.Dataset`, optional
131131
If a Dataset instance is passed, the y, v, X, n and associated arguments are ignored,
132132
and data is passed directly to the selected estimator.
@@ -138,13 +138,13 @@ def meta_regression(
138138
X_names : None or :obj:`list` of :obj:`str`, optional
139139
List of length P containing the names of the predictors.
140140
Ignored if ``data`` is provided (use ``X`` to specify columns).
141-
Default is None.
141+
Default = None.
142142
add_intercept : :obj:`bool`, optional
143143
If True, an intercept column is automatically added to the predictor matrix.
144144
If False, the predictors matrix is passed as-is to estimators.
145-
Default is True.
145+
Default = True.
146146
method : {"ML", "REML", "DL", "HE", "WLS", "FE", "Stan"}, optional
147-
Name of estimation method. Default is 'ML'.
147+
Name of estimation method. Default = 'ML'.
148148
Supported estimators include:
149149
150150
- 'ML': Maximum-likelihood estimator
@@ -155,10 +155,10 @@ def meta_regression(
155155
- 'Stan': Full Bayesian MCMC estimation via Stan
156156
ci_method : {"QP"}, optional
157157
Estimation method to use when computing uncertainty estimates.
158-
Currently only 'QP' is supported. Default is 'QP'.
158+
Currently only 'QP' is supported. Default = 'QP'.
159159
Ignored if ``method == 'Stan'``.
160160
alpha : :obj:`float`, optional
161-
Desired alpha level (CIs will have 1 - alpha coverage). Default is 0.05.
161+
Desired alpha level (CIs will have 1 - alpha coverage). Default = 0.05.
162162
**kwargs
163163
Optional keyword arguments to pass onto the chosen estimator.
164164

pymare/effectsize/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def solve_system(system, known_vars=None):
2525
A dictionary of known variables to use
2626
when evaluating the solution. Keys are the names of parameters
2727
(e.g., 'sem', 't'), values are numerical data types (including
28-
numpy arrays). Default is None.
28+
numpy arrays). Default = None.
2929
3030
Returns
3131
-------
@@ -134,7 +134,7 @@ def update_data(self, incremental=False, **kwargs):
134134
incremental : :obj:`bool`, optional
135135
If True, updates data incrementally (i.e., existing data will be preserved unless
136136
they're overwritten by incoming keys). If False, all existing data is dropped first.
137-
Default is False.
137+
Default = False.
138138
**kwargs
139139
Data values or arrays; keys are the names of the quantities.
140140
All inputs to ``__init__`` are valid.
@@ -231,7 +231,7 @@ class OneSampleEffectSizeConverter(EffectSizeConverter):
231231
Column names must match the controlled names listed below for
232232
kwargs. If additional kwargs are provided, they will take
233233
precedence over the values in the data frame.
234-
Default is None.
234+
Default = None.
235235
m : None or :obj:`numpy.ndarray`, optional
236236
Means or other continuous estimates
237237
sd : None or :obj:`numpy.ndarray`, optional

pymare/estimators/combination.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ def summary(self):
6262
class StoufferCombinationTest(CombinationTest):
6363
"""Stouffer's Z-score meta-analysis method.
6464
65-
Takes a set of independent z-scores and combines them via Stouffer's method
66-
to produce a fixed-effect estimate of the combined effect.
65+
Takes a set of independent z-scores and combines them via Stouffer's
66+
:footcite:p:`stouffer1949american` method to produce a fixed-effect estimate of the combined
67+
effect.
6768
6869
Parameters
6970
----------
7071
mode : {"directed", "undirected", "concordant"}, optional
71-
The type of test to perform-- i.e., what null hypothesis to
72-
reject. See Winkler et al. (2016) for details.
72+
The type of test to perform-- i.e., what null hypothesis to reject.
73+
See :footcite:t:`winkler2016non` for details.
7374
Valid options are:
7475
7576
- 'directed': tests a directional hypothesis--i.e., that the
@@ -99,6 +100,10 @@ class StoufferCombinationTest(CombinationTest):
99100
users should instead opt for 'directed' or 'concordant'.
100101
(3) This estimator does not support meta-regression; any moderators
101102
passed in to fit() as the X array will be ignored.
103+
104+
References
105+
----------
106+
.. footbibliography::
102107
"""
103108

104109
# Maps Dataset attributes onto fit() args; see BaseEstimator for details.
@@ -119,14 +124,18 @@ def p_value(self, z, w=None):
119124
class FisherCombinationTest(CombinationTest):
120125
"""Fisher's method for combining p-values.
121126
122-
Takes a set of independent z-scores and combines them via Fisher's method
123-
to produce a fixed-effect estimate of the combined effect.
127+
Takes a set of independent z-scores and combines them via Fisher's
128+
:footcite:p:`fisher1946statistical` method to produce a fixed-effect estimate of the combined
129+
effect.
124130
131+
Parameters
132+
----------
125133
mode : {"directed", "undirected", "concordant"}, optional
126-
The type of test to perform-- i.e., what null hypothesis to
127-
reject. See Winkler et al. (2016) for details. Valid options are:
134+
The type of test to perform-- i.e., what null hypothesis to reject.
135+
See :footcite:t:`winkler2016non` for details.
136+
Valid options are:
128137
129-
- 'directed': tests a directional hypothesis--i.e., that the
138+
- 'directed': tests a directional hypothesis--i.e., that the
130139
observed value is consistently greater than 0 in the input
131140
studies. This is the default.
132141
- 'undirected': tests an undirected hypothesis--i.e., that the
@@ -153,6 +162,10 @@ class FisherCombinationTest(CombinationTest):
153162
users should instead opt for 'directed' or 'concordant'.
154163
(3) This estimator does not support meta-regression; any moderators
155164
passed in to fit() as the X array will be ignored.
165+
166+
References
167+
----------
168+
.. footbibliography::
156169
"""
157170

158171
# Maps Dataset attributes onto fit() args; see BaseEstimator for details.

0 commit comments

Comments
 (0)