PyMARE 0.0.3rc2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyMARE-0.0.4/LICENSE +21 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PKG-INFO +6 -6
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/PKG-INFO +6 -6
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/SOURCES.txt +7 -1
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/requires.txt +7 -3
- PyMARE-0.0.4/pymare/__init__.py +50 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/_version.py +3 -3
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/core.py +86 -21
- PyMARE-0.0.4/pymare/datasets/__init__.py +7 -0
- PyMARE-0.0.4/pymare/datasets/metadat.py +55 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/effectsize/__init__.py +1 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/effectsize/base.py +4 -6
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/estimators/__init__.py +1 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/estimators/combination.py +94 -17
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/estimators/estimators.py +180 -76
- PyMARE-0.0.4/pymare/resources/datasets/michael2013.json +62 -0
- PyMARE-0.0.4/pymare/resources/datasets/michael2013.tsv +13 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/results.py +175 -26
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/stats.py +110 -16
- PyMARE-0.0.4/pymare/utils.py +58 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pyproject.toml +2 -2
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/setup.cfg +13 -8
- PyMARE-0.0.3rc2/pymare/__init__.py +0 -15
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/MANIFEST.in +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/dependency_links.txt +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/not-zip-safe +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/PyMARE.egg-info/top_level.txt +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/README.md +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/effectsize/expressions.json +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/pymare/effectsize/expressions.py +1 -1
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/setup.py +0 -0
- {PyMARE-0.0.3rc2 → PyMARE-0.0.4}/versioneer.py +0 -0
PyMARE-0.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020- pymare developers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyMARE
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: PyMARE: Python Meta-Analysis & Regression Engine
|
|
5
5
|
Home-page: https://github.com/neurostuff/PyMARE
|
|
6
6
|
Author: PyMARE developers
|
|
7
|
-
Author-email:
|
|
8
|
-
Maintainer:
|
|
7
|
+
Author-email: tsalo006@fiu.edu
|
|
8
|
+
Maintainer: Taylor Salo
|
|
9
9
|
Maintainer-email: tsalo006@fiu.edu
|
|
10
10
|
License: MIT
|
|
11
11
|
Description:
|
|
@@ -28,12 +28,12 @@ Classifier: Environment :: Console
|
|
|
28
28
|
Classifier: Intended Audience :: Science/Research
|
|
29
29
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
32
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
33
31
|
Classifier: Programming Language :: Python :: 3.8
|
|
34
32
|
Classifier: Programming Language :: Python :: 3.9
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
35
|
Classifier: Topic :: Scientific/Engineering
|
|
36
|
-
Requires-Python: >=3.
|
|
36
|
+
Requires-Python: >=3.8
|
|
37
37
|
Description-Content-Type: text/x-rst
|
|
38
38
|
Provides-Extra: doc
|
|
39
39
|
Provides-Extra: tests
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyMARE
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: PyMARE: Python Meta-Analysis & Regression Engine
|
|
5
5
|
Home-page: https://github.com/neurostuff/PyMARE
|
|
6
6
|
Author: PyMARE developers
|
|
7
|
-
Author-email:
|
|
8
|
-
Maintainer:
|
|
7
|
+
Author-email: tsalo006@fiu.edu
|
|
8
|
+
Maintainer: Taylor Salo
|
|
9
9
|
Maintainer-email: tsalo006@fiu.edu
|
|
10
10
|
License: MIT
|
|
11
11
|
Description:
|
|
@@ -28,12 +28,12 @@ Classifier: Environment :: Console
|
|
|
28
28
|
Classifier: Intended Audience :: Science/Research
|
|
29
29
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
32
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
33
31
|
Classifier: Programming Language :: Python :: 3.8
|
|
34
32
|
Classifier: Programming Language :: Python :: 3.9
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
35
|
Classifier: Topic :: Scientific/Engineering
|
|
36
|
-
Requires-Python: >=3.
|
|
36
|
+
Requires-Python: >=3.8
|
|
37
37
|
Description-Content-Type: text/x-rst
|
|
38
38
|
Provides-Extra: doc
|
|
39
39
|
Provides-Extra: tests
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
LICENSE
|
|
1
2
|
MANIFEST.in
|
|
2
3
|
README.md
|
|
3
4
|
pyproject.toml
|
|
@@ -15,10 +16,15 @@ pymare/_version.py
|
|
|
15
16
|
pymare/core.py
|
|
16
17
|
pymare/results.py
|
|
17
18
|
pymare/stats.py
|
|
19
|
+
pymare/utils.py
|
|
20
|
+
pymare/datasets/__init__.py
|
|
21
|
+
pymare/datasets/metadat.py
|
|
18
22
|
pymare/effectsize/__init__.py
|
|
19
23
|
pymare/effectsize/base.py
|
|
20
24
|
pymare/effectsize/expressions.json
|
|
21
25
|
pymare/effectsize/expressions.py
|
|
22
26
|
pymare/estimators/__init__.py
|
|
23
27
|
pymare/estimators/combination.py
|
|
24
|
-
pymare/estimators/estimators.py
|
|
28
|
+
pymare/estimators/estimators.py
|
|
29
|
+
pymare/resources/datasets/michael2013.json
|
|
30
|
+
pymare/resources/datasets/michael2013.tsv
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
numpy>=1.8.0
|
|
2
2
|
pandas
|
|
3
|
-
scipy
|
|
3
|
+
scipy<1.13.0
|
|
4
4
|
sympy
|
|
5
5
|
wrapt
|
|
6
6
|
|
|
@@ -15,8 +15,9 @@ seaborn
|
|
|
15
15
|
sphinx>=3.5
|
|
16
16
|
sphinx-argparse
|
|
17
17
|
sphinx-copybutton
|
|
18
|
-
sphinx_gallery
|
|
18
|
+
sphinx_gallery
|
|
19
19
|
sphinx_rtd_theme
|
|
20
|
+
sphinxcontrib-bibtex
|
|
20
21
|
codecov
|
|
21
22
|
coverage
|
|
22
23
|
coveralls
|
|
@@ -26,6 +27,8 @@ flake8-docstrings
|
|
|
26
27
|
flake8-isort
|
|
27
28
|
pytest
|
|
28
29
|
pytest-cov
|
|
30
|
+
pystan
|
|
31
|
+
arviz
|
|
29
32
|
|
|
30
33
|
[doc]
|
|
31
34
|
m2r
|
|
@@ -38,8 +41,9 @@ seaborn
|
|
|
38
41
|
sphinx>=3.5
|
|
39
42
|
sphinx-argparse
|
|
40
43
|
sphinx-copybutton
|
|
41
|
-
sphinx_gallery
|
|
44
|
+
sphinx_gallery
|
|
42
45
|
sphinx_rtd_theme
|
|
46
|
+
sphinxcontrib-bibtex
|
|
43
47
|
|
|
44
48
|
[stan]
|
|
45
49
|
pystan
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""PyMARE: Python Meta-Analysis & Regression Engine."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from .core import Dataset, meta_regression
|
|
7
|
+
from .effectsize import OneSampleEffectSizeConverter, TwoSampleEffectSizeConverter
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"Dataset",
|
|
11
|
+
"meta_regression",
|
|
12
|
+
"OneSampleEffectSizeConverter",
|
|
13
|
+
"TwoSampleEffectSizeConverter",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
from . import _version
|
|
17
|
+
|
|
18
|
+
__version__ = _version.get_versions()["version"]
|
|
19
|
+
del _version
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _py367_deprecation_warning():
|
|
23
|
+
"""Deprecation warnings message.
|
|
24
|
+
|
|
25
|
+
Notes
|
|
26
|
+
-----
|
|
27
|
+
Adapted from NiMARE.
|
|
28
|
+
"""
|
|
29
|
+
py36_warning = (
|
|
30
|
+
"Python 3.6 and 3.7 support is deprecated and will be removed in release 0.0.5 of PyMARE. "
|
|
31
|
+
"Consider switching to Python 3.8, 3.9."
|
|
32
|
+
)
|
|
33
|
+
warnings.filterwarnings("once", message=py36_warning)
|
|
34
|
+
warnings.warn(message=py36_warning, category=FutureWarning, stacklevel=3)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _python_deprecation_warnings():
|
|
38
|
+
"""Raise deprecation warnings.
|
|
39
|
+
|
|
40
|
+
Notes
|
|
41
|
+
-----
|
|
42
|
+
Adapted from NiMARE.
|
|
43
|
+
"""
|
|
44
|
+
if sys.version_info.major == 3 and (
|
|
45
|
+
sys.version_info.minor == 6 or sys.version_info.minor == 7
|
|
46
|
+
):
|
|
47
|
+
_py367_deprecation_warning()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_python_deprecation_warnings()
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "
|
|
11
|
+
"date": "2024-04-17T13:45:32-0500",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.0.
|
|
14
|
+
"full-revisionid": "624968ecc3acf081014853004b3c3804b788e562",
|
|
15
|
+
"version": "0.0.4"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -5,6 +5,8 @@ from functools import partial
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
import pandas as pd
|
|
7
7
|
|
|
8
|
+
from pymare.utils import _check_inputs_shape, _listify
|
|
9
|
+
|
|
8
10
|
from .estimators import (
|
|
9
11
|
DerSimonianLaird,
|
|
10
12
|
Hedges,
|
|
@@ -24,40 +26,39 @@ class Dataset:
|
|
|
24
26
|
y : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
25
27
|
1d array of study-level estimates with length K, or the name of the column in data
|
|
26
28
|
containing the y values.
|
|
27
|
-
Default
|
|
29
|
+
Default = None.
|
|
28
30
|
v : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
29
31
|
1d array of study-level variances with length K, or the name of the column in data
|
|
30
32
|
containing v values.
|
|
31
|
-
Default
|
|
33
|
+
Default = None.
|
|
32
34
|
X : None or :obj:`numpy.ndarray` of shape (K,[P]) or :obj:`list` of :obj:`str`, optional
|
|
33
35
|
1d or 2d array containing study-level predictors (dimensions K x P),
|
|
34
36
|
or a list of strings giving the names of the columns in data containing the X values.
|
|
35
|
-
Default
|
|
37
|
+
Default = None.
|
|
36
38
|
n : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
37
39
|
1d array of study-level sample sizes (length K), or the name of the corresponding column
|
|
38
40
|
in ``data``.
|
|
39
|
-
Default
|
|
41
|
+
Default = None.
|
|
40
42
|
data : None or :obj:`pandas.DataFrame`, optional
|
|
41
43
|
A pandas DataFrame containing y, v, X, and/or n values.
|
|
42
44
|
By default, columns are expected to have the same names as arguments
|
|
43
45
|
(e.g., the y values will be expected in the 'y' column).
|
|
44
46
|
This can be modified by passing strings giving column names to any of the ``y``, ``v``,
|
|
45
47
|
``X``, or ``n`` arguments.
|
|
46
|
-
Default
|
|
48
|
+
Default = None.
|
|
47
49
|
X_names : None or :obj:`list` of :obj:`str`, optional
|
|
48
50
|
List of length P containing the names of the predictors.
|
|
49
51
|
Ignored if ``data`` is provided (use ``X`` to specify columns).
|
|
50
|
-
Default
|
|
52
|
+
Default = None.
|
|
51
53
|
add_intercept : :obj:`bool`, optional
|
|
52
54
|
If True, an intercept column is automatically added to the predictor matrix.
|
|
53
55
|
If False, the predictors matrix is passed as-is to estimators.
|
|
54
|
-
Default
|
|
56
|
+
Default = True.
|
|
55
57
|
"""
|
|
56
58
|
|
|
57
59
|
def __init__(
|
|
58
60
|
self, y=None, v=None, X=None, n=None, data=None, X_names=None, add_intercept=True
|
|
59
61
|
):
|
|
60
|
-
|
|
61
62
|
if y is None and data is None:
|
|
62
63
|
raise ValueError(
|
|
63
64
|
"If no y values are provided, a pandas DataFrame "
|
|
@@ -65,12 +66,25 @@ class Dataset:
|
|
|
65
66
|
"data argument."
|
|
66
67
|
)
|
|
67
68
|
|
|
69
|
+
if (X is None) and (not add_intercept):
|
|
70
|
+
raise ValueError("If no X matrix is provided, add_intercept must be True!")
|
|
71
|
+
|
|
68
72
|
# Extract columns from DataFrame
|
|
69
73
|
if data is not None:
|
|
70
74
|
y = data.loc[:, y or "y"].values
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
|
|
76
|
+
# v is optional
|
|
77
|
+
if (v is not None) or ("v" in data.columns):
|
|
78
|
+
v = data.loc[:, v or "v"].values
|
|
79
|
+
|
|
80
|
+
# X is optional
|
|
81
|
+
if (X is not None) or ("X" in data.columns):
|
|
82
|
+
X_names = X or "X"
|
|
83
|
+
X = data.loc[:, X_names].values
|
|
84
|
+
|
|
85
|
+
# n is optional
|
|
86
|
+
if (n is not None) or ("n" in data.columns):
|
|
87
|
+
n = data.loc[:, n or "n"].values
|
|
74
88
|
|
|
75
89
|
self.y = ensure_2d(y)
|
|
76
90
|
self.v = ensure_2d(v)
|
|
@@ -79,20 +93,71 @@ class Dataset:
|
|
|
79
93
|
self.X = X
|
|
80
94
|
self.X_names = names
|
|
81
95
|
|
|
96
|
+
_check_inputs_shape(self.y, self.X, "y", "X", row=True)
|
|
97
|
+
_check_inputs_shape(self.y, self.v, "y", "v", row=True, column=True)
|
|
98
|
+
_check_inputs_shape(self.y, self.n, "y", "n", row=True, column=True)
|
|
99
|
+
|
|
82
100
|
def _get_predictors(self, X, names, add_intercept):
|
|
83
101
|
if X is None and not add_intercept:
|
|
84
102
|
raise ValueError(
|
|
85
103
|
"No fixed predictors found. If no X matrix is "
|
|
86
104
|
"provided, add_intercept must be True!"
|
|
87
105
|
)
|
|
106
|
+
|
|
88
107
|
X = pd.DataFrame(X)
|
|
89
108
|
if names is not None:
|
|
90
|
-
X.columns = names
|
|
109
|
+
X.columns = _listify(names)
|
|
110
|
+
|
|
91
111
|
if add_intercept:
|
|
92
112
|
intercept = pd.DataFrame({"intercept": np.ones(len(self.y))})
|
|
93
113
|
X = pd.concat([intercept, X], axis=1)
|
|
114
|
+
|
|
94
115
|
return X.values, X.columns.tolist()
|
|
95
116
|
|
|
117
|
+
def to_df(self):
|
|
118
|
+
"""Convert the dataset to a pandas DataFrame.
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
:obj:`pandas.DataFrame`
|
|
123
|
+
A DataFrame containing the y, v, X, and n values.
|
|
124
|
+
"""
|
|
125
|
+
if self.y.shape[1] == 1:
|
|
126
|
+
df = pd.DataFrame({"y": self.y[:, 0]})
|
|
127
|
+
|
|
128
|
+
if self.v is not None:
|
|
129
|
+
df["v"] = self.v[:, 0]
|
|
130
|
+
|
|
131
|
+
if self.n is not None:
|
|
132
|
+
df["n"] = self.n[:, 0]
|
|
133
|
+
|
|
134
|
+
df[self.X_names] = self.X
|
|
135
|
+
|
|
136
|
+
else:
|
|
137
|
+
all_dfs = []
|
|
138
|
+
for i_set in range(self.y.shape[1]):
|
|
139
|
+
df = pd.DataFrame(
|
|
140
|
+
{
|
|
141
|
+
"set": np.full(self.y.shape[0], i_set),
|
|
142
|
+
"y": self.y[:, i_set],
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
if self.v is not None:
|
|
147
|
+
df["v"] = self.v[:, i_set]
|
|
148
|
+
|
|
149
|
+
if self.n is not None:
|
|
150
|
+
df["n"] = self.n[:, i_set]
|
|
151
|
+
|
|
152
|
+
# X is the same across sets
|
|
153
|
+
df[self.X_names] = self.X
|
|
154
|
+
|
|
155
|
+
all_dfs.append(df)
|
|
156
|
+
|
|
157
|
+
df = pd.concat(all_dfs, axis=0)
|
|
158
|
+
|
|
159
|
+
return df
|
|
160
|
+
|
|
96
161
|
|
|
97
162
|
def meta_regression(
|
|
98
163
|
y=None,
|
|
@@ -114,19 +179,19 @@ def meta_regression(
|
|
|
114
179
|
y : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
115
180
|
1d array of study-level estimates with length K, or the name of the column in data
|
|
116
181
|
containing the y values.
|
|
117
|
-
Default
|
|
182
|
+
Default = None.
|
|
118
183
|
v : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
119
184
|
1d array of study-level variances with length K, or the name of the column in data
|
|
120
185
|
containing v values.
|
|
121
|
-
Default
|
|
186
|
+
Default = None.
|
|
122
187
|
X : None or :obj:`numpy.ndarray` of shape (K,[P]) or :obj:`list` of :obj:`str`, optional
|
|
123
188
|
1d or 2d array containing study-level predictors (dimensions K x P),
|
|
124
189
|
or a list of strings giving the names of the columns in data containing the X values.
|
|
125
|
-
Default
|
|
190
|
+
Default = None.
|
|
126
191
|
n : None or :obj:`numpy.ndarray` of shape (K,) or :obj:`str`, optional
|
|
127
192
|
1d array of study-level sample sizes (length K), or the name of the corresponding column
|
|
128
193
|
in ``data``.
|
|
129
|
-
Default
|
|
194
|
+
Default = None.
|
|
130
195
|
data : None or :obj:`pandas.DataFrame` or :obj:`~pymare.core.Dataset`, optional
|
|
131
196
|
If a Dataset instance is passed, the y, v, X, n and associated arguments are ignored,
|
|
132
197
|
and data is passed directly to the selected estimator.
|
|
@@ -138,13 +203,13 @@ def meta_regression(
|
|
|
138
203
|
X_names : None or :obj:`list` of :obj:`str`, optional
|
|
139
204
|
List of length P containing the names of the predictors.
|
|
140
205
|
Ignored if ``data`` is provided (use ``X`` to specify columns).
|
|
141
|
-
Default
|
|
206
|
+
Default = None.
|
|
142
207
|
add_intercept : :obj:`bool`, optional
|
|
143
208
|
If True, an intercept column is automatically added to the predictor matrix.
|
|
144
209
|
If False, the predictors matrix is passed as-is to estimators.
|
|
145
|
-
Default
|
|
210
|
+
Default = True.
|
|
146
211
|
method : {"ML", "REML", "DL", "HE", "WLS", "FE", "Stan"}, optional
|
|
147
|
-
Name of estimation method. Default
|
|
212
|
+
Name of estimation method. Default = 'ML'.
|
|
148
213
|
Supported estimators include:
|
|
149
214
|
|
|
150
215
|
- 'ML': Maximum-likelihood estimator
|
|
@@ -155,10 +220,10 @@ def meta_regression(
|
|
|
155
220
|
- 'Stan': Full Bayesian MCMC estimation via Stan
|
|
156
221
|
ci_method : {"QP"}, optional
|
|
157
222
|
Estimation method to use when computing uncertainty estimates.
|
|
158
|
-
Currently only 'QP' is supported. Default
|
|
223
|
+
Currently only 'QP' is supported. Default = 'QP'.
|
|
159
224
|
Ignored if ``method == 'Stan'``.
|
|
160
225
|
alpha : :obj:`float`, optional
|
|
161
|
-
Desired alpha level (CIs will have 1 - alpha coverage). Default
|
|
226
|
+
Desired alpha level (CIs will have 1 - alpha coverage). Default = 0.05.
|
|
162
227
|
**kwargs
|
|
163
228
|
Optional keyword arguments to pass onto the chosen estimator.
|
|
164
229
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Datasets from metadat."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os.path as op
|
|
5
|
+
|
|
6
|
+
import pandas as pd
|
|
7
|
+
|
|
8
|
+
from pymare.utils import get_resource_path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def michael2013():
|
|
12
|
+
"""Load a dataset of studies on the persuasive power of a brain image.
|
|
13
|
+
|
|
14
|
+
This dataset was published in :footcite:t:`michael2013non`,
|
|
15
|
+
and was curated in metadat :footcite:p:`white2022metadat`.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
df : :obj:`~pandas.DataFrame`
|
|
20
|
+
A dataframe with the following columns:
|
|
21
|
+
|
|
22
|
+
- ``"Study"``: the study name
|
|
23
|
+
- ``"No_brain_n"``: the sample size for no-brain-image condition
|
|
24
|
+
- ``"No_brain_m"``: mean agreement rating for no-brain-image condition
|
|
25
|
+
- ``"No_brain_s"``: standard deviation of agreement rating for no-brain-image condition
|
|
26
|
+
- ``"Brain_n"``: the sample size for brain-image condition
|
|
27
|
+
- ``"Brain_m"``: mean agreement rating for brain-image condition
|
|
28
|
+
- ``"Brain_s"``: standard deviation of agreement rating for brain-image condition
|
|
29
|
+
- ``"Included_Critique"``: whether a critique was included in the study or not
|
|
30
|
+
- ``"Medium"``: the medium of the study
|
|
31
|
+
- ``"Compensation"``: notes on the compensation of the study
|
|
32
|
+
- ``"Participant_Pool"``: notes on where participants were recruited
|
|
33
|
+
- ``"yi"``: Raw mean difference, calculated as Brain_m - No_brain_m
|
|
34
|
+
- ``"vi"``: Corresponding sampling variance
|
|
35
|
+
|
|
36
|
+
metadata : :obj:`dict`
|
|
37
|
+
A dictionary with metadata about the columns in the dataset.
|
|
38
|
+
|
|
39
|
+
Notes
|
|
40
|
+
-----
|
|
41
|
+
For more information about this dataset, see metadat's documentation:
|
|
42
|
+
https://wviechtb.github.io/metadat/reference/dat.michael2013.html
|
|
43
|
+
|
|
44
|
+
References
|
|
45
|
+
----------
|
|
46
|
+
.. footbibliography::
|
|
47
|
+
"""
|
|
48
|
+
dataset_dir = op.join(get_resource_path(), "datasets")
|
|
49
|
+
tsv_file = op.join(dataset_dir, "michael2013.tsv")
|
|
50
|
+
json_file = op.join(dataset_dir, "michael2013.json")
|
|
51
|
+
df = pd.read_table(tsv_file)
|
|
52
|
+
with open(json_file, "r") as fo:
|
|
53
|
+
metadata = json.load(fo)
|
|
54
|
+
|
|
55
|
+
return df, metadata
|
|
@@ -25,7 +25,7 @@ def solve_system(system, known_vars=None):
|
|
|
25
25
|
A dictionary of known variables to use
|
|
26
26
|
when evaluating the solution. Keys are the names of parameters
|
|
27
27
|
(e.g., 'sem', 't'), values are numerical data types (including
|
|
28
|
-
numpy arrays). Default
|
|
28
|
+
numpy arrays). Default = None.
|
|
29
29
|
|
|
30
30
|
Returns
|
|
31
31
|
-------
|
|
@@ -68,7 +68,7 @@ def solve_system(system, known_vars=None):
|
|
|
68
68
|
|
|
69
69
|
# solver will return a dict if there's only one non-dummy expression
|
|
70
70
|
if isinstance(solutions, dict):
|
|
71
|
-
solutions = [
|
|
71
|
+
solutions = [[solutions[s] for s in symbols]]
|
|
72
72
|
|
|
73
73
|
# Prepare the dummy list and data args in a fixed order
|
|
74
74
|
dummy_list = list(dummies)
|
|
@@ -90,7 +90,6 @@ class EffectSizeConverter(metaclass=ABCMeta):
|
|
|
90
90
|
"""Base class for effect size converters."""
|
|
91
91
|
|
|
92
92
|
def __init__(self, data=None, **kwargs):
|
|
93
|
-
|
|
94
93
|
kwargs = {k: v for k, v in kwargs.items() if v is not None}
|
|
95
94
|
|
|
96
95
|
if data is not None:
|
|
@@ -134,7 +133,7 @@ class EffectSizeConverter(metaclass=ABCMeta):
|
|
|
134
133
|
incremental : :obj:`bool`, optional
|
|
135
134
|
If True, updates data incrementally (i.e., existing data will be preserved unless
|
|
136
135
|
they're overwritten by incoming keys). If False, all existing data is dropped first.
|
|
137
|
-
Default
|
|
136
|
+
Default = False.
|
|
138
137
|
**kwargs
|
|
139
138
|
Data values or arrays; keys are the names of the quantities.
|
|
140
139
|
All inputs to ``__init__`` are valid.
|
|
@@ -231,7 +230,7 @@ class OneSampleEffectSizeConverter(EffectSizeConverter):
|
|
|
231
230
|
Column names must match the controlled names listed below for
|
|
232
231
|
kwargs. If additional kwargs are provided, they will take
|
|
233
232
|
precedence over the values in the data frame.
|
|
234
|
-
Default
|
|
233
|
+
Default = None.
|
|
235
234
|
m : None or :obj:`numpy.ndarray`, optional
|
|
236
235
|
Means or other continuous estimates
|
|
237
236
|
sd : None or :obj:`numpy.ndarray`, optional
|
|
@@ -509,7 +508,6 @@ def compute_measure(
|
|
|
509
508
|
|
|
510
509
|
# Select or infer converter class
|
|
511
510
|
if comparison == "infer":
|
|
512
|
-
|
|
513
511
|
one_samp_inputs = {"m", "sd", "n", "r"}
|
|
514
512
|
two_samp_inputs = {"m1", "m2", "sd1", "sd2", "n1", "n2"}
|
|
515
513
|
|