PyMetaAnalysis 0.1.0__py3-none-any.whl
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.
- meta_analyze/__init__.py +62 -0
- meta_analyze/_version.py +3 -0
- meta_analyze/api.py +330 -0
- meta_analyze/binary_api.py +539 -0
- meta_analyze/config.py +34 -0
- meta_analyze/continuous_api.py +353 -0
- meta_analyze/data.py +181 -0
- meta_analyze/effect_sizes/__init__.py +17 -0
- meta_analyze/effect_sizes/binary.py +412 -0
- meta_analyze/effect_sizes/continuous.py +271 -0
- meta_analyze/estimators/__init__.py +14 -0
- meta_analyze/estimators/inverse_variance.py +169 -0
- meta_analyze/estimators/mantel_haenszel.py +101 -0
- meta_analyze/estimators/tau2.py +182 -0
- meta_analyze/exceptions.py +21 -0
- meta_analyze/heterogeneity.py +99 -0
- meta_analyze/plotting/__init__.py +7 -0
- meta_analyze/plotting/_utils.py +67 -0
- meta_analyze/plotting/forest.py +193 -0
- meta_analyze/plotting/funnel.py +168 -0
- meta_analyze/plotting/subgroup_forest.py +284 -0
- meta_analyze/provenance.py +185 -0
- meta_analyze/py.typed +1 -0
- meta_analyze/reporting.py +433 -0
- meta_analyze/results.py +519 -0
- meta_analyze/sensitivity.py +546 -0
- meta_analyze/subgroups.py +165 -0
- pymetaanalysis-0.1.0.dist-info/METADATA +218 -0
- pymetaanalysis-0.1.0.dist-info/RECORD +31 -0
- pymetaanalysis-0.1.0.dist-info/WHEEL +4 -0
- pymetaanalysis-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyMetaAnalysis
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A pandas-first, auditable meta-analysis library for Python
|
|
5
|
+
Project-URL: Documentation, https://zhaoboding.github.io/PyMetaAnalysis/
|
|
6
|
+
Project-URL: Source, https://github.com/ZhaoboDing/PyMetaAnalysis
|
|
7
|
+
Project-URL: Issues, https://github.com/ZhaoboDing/PyMetaAnalysis/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/ZhaoboDing/PyMetaAnalysis/blob/main/CHANGELOG.md
|
|
9
|
+
Author: PyMetaAnalysis contributors
|
|
10
|
+
Maintainer-email: Zhaobo Ding <ding.zb@yahoo.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: evidence-based medicine,meta-analysis,statistics,systematic review
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Requires-Dist: pandas>=2.0
|
|
25
|
+
Requires-Dist: scipy>=1.10
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: actionlint-py>=1.7.12.24; extra == 'dev'
|
|
28
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
29
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
30
|
+
Requires-Dist: pandas-stubs>=2.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
32
|
+
Requires-Dist: scipy-stubs>=1.10; extra == 'dev'
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
35
|
+
Provides-Extra: notebook
|
|
36
|
+
Requires-Dist: ipykernel>=6.29; extra == 'notebook'
|
|
37
|
+
Requires-Dist: jupyterlab>=4.0; extra == 'notebook'
|
|
38
|
+
Requires-Dist: matplotlib>=3.7; extra == 'notebook'
|
|
39
|
+
Requires-Dist: nbclient>=0.10; extra == 'notebook'
|
|
40
|
+
Requires-Dist: nbformat>=5.10; extra == 'notebook'
|
|
41
|
+
Provides-Extra: plot
|
|
42
|
+
Requires-Dist: matplotlib>=3.7; extra == 'plot'
|
|
43
|
+
Provides-Extra: test
|
|
44
|
+
Requires-Dist: hypothesis>=6.100; extra == 'test'
|
|
45
|
+
Requires-Dist: matplotlib>=3.7; extra == 'test'
|
|
46
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'test'
|
|
47
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# PyMetaAnalysis
|
|
51
|
+
|
|
52
|
+
[](https://github.com/ZhaoboDing/PyMetaAnalysis/actions/workflows/ci.yml)
|
|
53
|
+
[](https://zhaoboding.github.io/PyMetaAnalysis/)
|
|
54
|
+
[](LICENSE)
|
|
55
|
+
|
|
56
|
+
PyMetaAnalysis is an early-stage, pandas-first Python library for conventional
|
|
57
|
+
study-level meta-analysis. It accepts DataFrames, NumPy arrays, and ordinary
|
|
58
|
+
Python sequences, then returns immutable, auditable result objects containing
|
|
59
|
+
study effects, exclusions, weights, method choices, diagnostics, provenance,
|
|
60
|
+
and structured reports.
|
|
61
|
+
|
|
62
|
+
> **Early-stage:** the API may change during the 0.x series. Consequential
|
|
63
|
+
> results should be reviewed against the analysis protocol and independently
|
|
64
|
+
> checked.
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```console
|
|
69
|
+
python -m pip install PyMetaAnalysis
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Install optional Matplotlib plotting support with:
|
|
73
|
+
|
|
74
|
+
```console
|
|
75
|
+
python -m pip install "PyMetaAnalysis[plot]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The distribution name is `PyMetaAnalysis`; the import name is
|
|
79
|
+
`meta_analyze`.
|
|
80
|
+
|
|
81
|
+
## Quick start
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import meta_analyze as ma
|
|
85
|
+
|
|
86
|
+
result = ma.meta_analysis(
|
|
87
|
+
effect=[0.12, 0.35, -0.08, 0.21],
|
|
88
|
+
variance=[0.04, 0.06, 0.03, 0.05],
|
|
89
|
+
study=["Trial A", "Trial B", "Trial C", "Trial D"],
|
|
90
|
+
model="random",
|
|
91
|
+
tau2_method="REML",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
print(result.summary())
|
|
95
|
+
print(result.study_results)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
DataFrame column names work directly:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
result = ma.meta_analysis(
|
|
102
|
+
studies,
|
|
103
|
+
effect="effect",
|
|
104
|
+
variance="variance",
|
|
105
|
+
study="citation",
|
|
106
|
+
subgroup="region",
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Omit `study=` to use the DataFrame index. Supplying `subgroup=` returns a
|
|
111
|
+
dedicated result containing group fits, the overall fit, and a formal test for
|
|
112
|
+
subgroup differences.
|
|
113
|
+
|
|
114
|
+
## Supported analyses
|
|
115
|
+
|
|
116
|
+
| Input | Effects | Pooling/models |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| Effect + sampling variance | Generic | Common/random inverse variance |
|
|
119
|
+
| Two-group events + totals | OR, RR, RD | Common MH OR/RR; common/random IV |
|
|
120
|
+
| Two-group means + SDs + sizes | MD, Hedges' g | Common/random inverse variance |
|
|
121
|
+
|
|
122
|
+
Random-effects inverse-variance models support REML (default), Paule-Mandel,
|
|
123
|
+
and DerSimonian-Laird tau-squared estimators. Mean confidence intervals support
|
|
124
|
+
the normal default plus unmodified and safeguarded Hartung-Knapp variants.
|
|
125
|
+
Eligible random-effects fits include an HTS prediction interval.
|
|
126
|
+
|
|
127
|
+
Sparse binary behavior is explicit: study-level and Mantel-Haenszel continuity
|
|
128
|
+
corrections are separate, relative-effect double-zero/double-all rows remain
|
|
129
|
+
visible as exclusions, and RD exposes
|
|
130
|
+
`rd_zero_variance="correct" | "exclude"`.
|
|
131
|
+
|
|
132
|
+
## Inspect and report
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
result.estimate
|
|
136
|
+
result.display_estimate
|
|
137
|
+
result.ci
|
|
138
|
+
result.tau2
|
|
139
|
+
result.i2
|
|
140
|
+
result.i2_method
|
|
141
|
+
result.diagnostics
|
|
142
|
+
result.provenance
|
|
143
|
+
|
|
144
|
+
methods_text = result.method_details()
|
|
145
|
+
report = result.report()
|
|
146
|
+
payload = report.to_dict()
|
|
147
|
+
json_text = report.to_json()
|
|
148
|
+
markdown = report.to_markdown()
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
OR and RR remain on the log model scale in auditable numeric attributes;
|
|
152
|
+
`display_estimate`, `display_ci`, and `display_prediction_interval` provide
|
|
153
|
+
exponentiated ratios.
|
|
154
|
+
|
|
155
|
+
Rows excluded by missing-value or sparse-data policies remain in
|
|
156
|
+
`study_results` with a stable `row_id`, `included=False`, and an
|
|
157
|
+
`exclusion_reason`.
|
|
158
|
+
|
|
159
|
+
## Sensitivity and plots
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
leave_one_out = result.leave_one_out().to_dataframe()
|
|
163
|
+
cumulative = result.cumulative(order="publication_year").to_dataframe()
|
|
164
|
+
|
|
165
|
+
ax = result.forest(show_prediction_interval=True)
|
|
166
|
+
ax = result.funnel()
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Plotting methods return Matplotlib axes and never call `show()`. Funnel plots
|
|
170
|
+
are descriptive small-study-effect diagnostics, not proof of publication bias.
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
The complete documentation is published at
|
|
175
|
+
[zhaoboding.github.io/PyMetaAnalysis](https://zhaoboding.github.io/PyMetaAnalysis/).
|
|
176
|
+
|
|
177
|
+
- [Installation](docs/installation.md)
|
|
178
|
+
- [Getting started](docs/getting-started.md)
|
|
179
|
+
- [Input data and row decisions](docs/guides/input-data.md)
|
|
180
|
+
- [Generic](docs/guides/generic-effects.md), [binary](docs/guides/binary-outcomes.md), and [continuous](docs/guides/continuous-outcomes.md) guides
|
|
181
|
+
- [Choosing methods](docs/guides/method-selection.md) and [statistical formulas](docs/methods/statistical-methods.md)
|
|
182
|
+
- [Sensitivity analysis](docs/guides/sensitivity-analysis.md) and [plotting](docs/guides/plotting.md)
|
|
183
|
+
- [Public API](docs/reference/api.md), [result objects](docs/reference/results.md), and [report schema](docs/reference/report-schema.md)
|
|
184
|
+
- [Validation strategy](docs/validation.md) and [scope/limitations](docs/limitations.md)
|
|
185
|
+
- [Citation guidance](docs/citation.md)
|
|
186
|
+
- [R `meta`/`metafor` mapping](docs/guides/r-interoperability.md)
|
|
187
|
+
|
|
188
|
+
An executable [end-to-end notebook](examples/quickstart.ipynb) uses synthetic
|
|
189
|
+
data to demonstrate analysis, provenance, reporting, sensitivity, and plotting.
|
|
190
|
+
|
|
191
|
+
Build the complete site locally with:
|
|
192
|
+
|
|
193
|
+
```console
|
|
194
|
+
python -m pip install ".[docs]"
|
|
195
|
+
python -m mkdocs serve
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Validation status
|
|
199
|
+
|
|
200
|
+
The test suite combines hand calculations, statistical invariants, numerical
|
|
201
|
+
edge cases, and committed R `metafor` reference fixtures. CI covers Python
|
|
202
|
+
3.10–3.13, declared dependency lower bounds, strict typing/linting, docs, and
|
|
203
|
+
distribution builds.
|
|
204
|
+
|
|
205
|
+
This is independent cross-software validation, not a formal external
|
|
206
|
+
statistical audit. See [validation](docs/validation.md) for exact coverage.
|
|
207
|
+
|
|
208
|
+
## Contributing
|
|
209
|
+
|
|
210
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and the full
|
|
211
|
+
[development guide](docs/development.md). Statistical changes require formula
|
|
212
|
+
documentation, boundary tests, and an independent comparison where available.
|
|
213
|
+
|
|
214
|
+
Security-sensitive reports should follow [SECURITY.md](SECURITY.md).
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
meta_analyze/__init__.py,sha256=POInICUoVRrqR7s9sgJReHsbxBYNNlqagJDduHWC-3I,1602
|
|
2
|
+
meta_analyze/_version.py,sha256=-UYTpK8lRuzcw9BEWkdBHyJiS_vjvg0P06Wo2xs--us,77
|
|
3
|
+
meta_analyze/api.py,sha256=C3Hc9nmoFtYzC5ar5Lh2b-I3fisghquWs7ue6q1alu4,10763
|
|
4
|
+
meta_analyze/binary_api.py,sha256=kH_1zuAshRCJ_MjbbPt30CmMAPr49N2hASZmODnMaqM,18664
|
|
5
|
+
meta_analyze/config.py,sha256=IL8VX0xDRv18giwbk2m-P_XjBjOo_GsN_B-H4-C7s8E,831
|
|
6
|
+
meta_analyze/continuous_api.py,sha256=jAsVB9TqTDKGLw5MWCNGXxiBx5u9QVSeAR0fuN9WRYE,11457
|
|
7
|
+
meta_analyze/data.py,sha256=KVfjYJc-oHuFaaHqLN4aRHz5eoA7MOn9P6KxuoY-9oQ,6085
|
|
8
|
+
meta_analyze/exceptions.py,sha256=h4PPm8mcxSyUQax0YrqgIhy7GCF7wj2uVL4BWmwWImA,666
|
|
9
|
+
meta_analyze/heterogeneity.py,sha256=xQ2e5012AZG1YKuq2EDl4ccYgguC2Se5LJOT1WMHrVo,3308
|
|
10
|
+
meta_analyze/provenance.py,sha256=PrRubpJRn2muvJNun2juMKs-VV4QVT4T81BxvHNuKck,5858
|
|
11
|
+
meta_analyze/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
+
meta_analyze/reporting.py,sha256=cwf2UR-pUgm9KDszms2d9oiHuZKc2N_N0QEkqt5Z9-4,15958
|
|
13
|
+
meta_analyze/results.py,sha256=Jq9O0uwnmseQjYBNBSqtlXhh9U_D-th5b6nQHj3AsbQ,17048
|
|
14
|
+
meta_analyze/sensitivity.py,sha256=3p1Mu5AdeugYcLZtTV_2YEgfgmBJ_y1Bnbcgj33m5Mw,18584
|
|
15
|
+
meta_analyze/subgroups.py,sha256=CSevfbLfA79Z55RyLGKyjUSDl7TGladdHbrJXhKSzCY,5985
|
|
16
|
+
meta_analyze/effect_sizes/__init__.py,sha256=tYlgVfGehiCdPjU9_1JlDUpgXO9rMyUCc98zcrLuPCA,415
|
|
17
|
+
meta_analyze/effect_sizes/binary.py,sha256=5r4RBF0ENcInLk0pLtgdPuKG15mBxip3avPAhFnfC9I,14360
|
|
18
|
+
meta_analyze/effect_sizes/continuous.py,sha256=hKxS7qycki7Xy0rU-cHVzJ19nUnfrLy1qxgF2iUQTcU,9844
|
|
19
|
+
meta_analyze/estimators/__init__.py,sha256=kEqQQQThjZ5xf-DxBxWkJWq96zxHQDq2s_J6Ys9s7KY,413
|
|
20
|
+
meta_analyze/estimators/inverse_variance.py,sha256=VVVk1AaSiv3eEO8QLWA9BPZKww6RzG5-HyvWefekaNY,5927
|
|
21
|
+
meta_analyze/estimators/mantel_haenszel.py,sha256=Qya0B5diQuv3Pm2HOTGC6bqe0DKVzBSnYSdvv7HnPFY,3327
|
|
22
|
+
meta_analyze/estimators/tau2.py,sha256=id3rwNh87Hf1H8aX_ww_RnIGSPKuTGRBk9O1iKXJ_rc,5437
|
|
23
|
+
meta_analyze/plotting/__init__.py,sha256=7DzM-W_7Iqb0pf2IFLzEmaggFAhSzgNaOqDFSddRX4k,247
|
|
24
|
+
meta_analyze/plotting/_utils.py,sha256=3vg-0Wtjlf7LKpXkw2sNnkLNMAS83K_SwxXaneT742c,2090
|
|
25
|
+
meta_analyze/plotting/forest.py,sha256=NkqcJC7HLfDzl-fW2rNEeH2sozCVpZwsjFuPWFYVNKs,6088
|
|
26
|
+
meta_analyze/plotting/funnel.py,sha256=Mdy1O5uVw4OZF8PvXiDyG7AMANz7vkef9ru-D61_k1Q,5577
|
|
27
|
+
meta_analyze/plotting/subgroup_forest.py,sha256=hEIDtmme2javG6YgsHobAS5EK0lEoe07N0NweU9JDdg,8341
|
|
28
|
+
pymetaanalysis-0.1.0.dist-info/METADATA,sha256=yN4WCkkJUsDBQnqL4BtPLrtRTT1KFJRvtiCmlcZ_KIw,7864
|
|
29
|
+
pymetaanalysis-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
30
|
+
pymetaanalysis-0.1.0.dist-info/licenses/LICENSE,sha256=CBE_u7LfEteKb_1My8s9obP0YkjJVzcWlgHSDiqa9ts,1084
|
|
31
|
+
pymetaanalysis-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PyMetaAnalysis contributors
|
|
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.
|