PyMARE 0.0.4rc6__tar.gz → 0.0.6__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.
Files changed (31) hide show
  1. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PKG-INFO +1 -1
  2. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/PKG-INFO +1 -1
  3. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/_version.py +3 -3
  4. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/estimators/combination.py +21 -7
  5. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/LICENSE +0 -0
  6. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/MANIFEST.in +0 -0
  7. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/SOURCES.txt +0 -0
  8. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/dependency_links.txt +0 -0
  9. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/not-zip-safe +0 -0
  10. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/requires.txt +0 -0
  11. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/PyMARE.egg-info/top_level.txt +0 -0
  12. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/README.md +0 -0
  13. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/__init__.py +0 -0
  14. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/core.py +0 -0
  15. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/datasets/__init__.py +0 -0
  16. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/datasets/metadat.py +0 -0
  17. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/effectsize/__init__.py +0 -0
  18. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/effectsize/base.py +0 -0
  19. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/effectsize/expressions.json +0 -0
  20. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/effectsize/expressions.py +0 -0
  21. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/estimators/__init__.py +0 -0
  22. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/estimators/estimators.py +0 -0
  23. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/resources/datasets/michael2013.json +0 -0
  24. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/resources/datasets/michael2013.tsv +0 -0
  25. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/results.py +0 -0
  26. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/stats.py +0 -0
  27. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pymare/utils.py +0 -0
  28. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/pyproject.toml +0 -0
  29. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/setup.cfg +0 -0
  30. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/setup.py +0 -0
  31. {PyMARE-0.0.4rc6 → PyMARE-0.0.6}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyMARE
3
- Version: 0.0.4rc6
3
+ Version: 0.0.6
4
4
  Summary: PyMARE: Python Meta-Analysis & Regression Engine
5
5
  Home-page: https://github.com/neurostuff/PyMARE
6
6
  Author: PyMARE developers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyMARE
3
- Version: 0.0.4rc6
3
+ Version: 0.0.6
4
4
  Summary: PyMARE: Python Meta-Analysis & Regression Engine
5
5
  Home-page: https://github.com/neurostuff/PyMARE
6
6
  Author: PyMARE developers
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-04-17T13:45:32-0500",
11
+ "date": "2024-05-01T11:57:03-0500",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "624968ecc3acf081014853004b3c3804b788e562",
15
- "version": "0.0.4rc6"
14
+ "full-revisionid": "e94ddf32cd4ffbd4f5cf27e406bf9195745982f7",
15
+ "version": "0.0.6"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -113,7 +113,7 @@ class StoufferCombinationTest(CombinationTest):
113
113
  # Maps Dataset attributes onto fit() args; see BaseEstimator for details.
114
114
  _dataset_attr_map = {"z": "y", "w": "n", "g": "v"}
115
115
 
116
- def _inflation_term(self, z, w, g):
116
+ def _inflation_term(self, z, w, g, corr=None):
117
117
  """Calculate the variance inflation term for each group.
118
118
 
119
119
  This term is used to adjust the variance of the combined z-score when
@@ -127,6 +127,8 @@ class StoufferCombinationTest(CombinationTest):
127
127
  Array of weights.
128
128
  g : :obj:`numpy.ndarray` of shape (n, d)
129
129
  Array of group labels.
130
+ corr : :obj:`numpy.ndarray` of shape (n, n), optional
131
+ The correlation matrix of the z-values. If None, it will be calculated.
130
132
 
131
133
  Returns
132
134
  -------
@@ -157,26 +159,38 @@ class StoufferCombinationTest(CombinationTest):
157
159
  continue
158
160
 
159
161
  # Calculate the within group correlation matrix and sum the non-diagonal elements
160
- corr = np.corrcoef(group_z, rowvar=True)
162
+ if corr is None:
163
+ if z.shape[1] < 2:
164
+ raise ValueError("The number of features must be greater than 1.")
165
+ group_corr = np.corrcoef(group_z, rowvar=True)
166
+ else:
167
+ group_corr = corr[group_indices][:, group_indices]
168
+
161
169
  upper_indices = np.triu_indices(n_samples, k=1)
162
- non_diag_corr = corr[upper_indices]
170
+ non_diag_corr = group_corr[upper_indices]
163
171
  w_i, w_j = weights[upper_indices[0]], weights[upper_indices[1]]
164
172
 
165
173
  sigma += (2 * w_i * w_j * non_diag_corr).sum()
166
174
 
167
175
  return sigma
168
176
 
169
- def fit(self, z, w=None, g=None):
177
+ def fit(self, z, w=None, g=None, corr=None):
170
178
  """Fit the estimator to z-values, optionally with weights and groups."""
171
- return super().fit(z, w=w, g=g)
179
+ return super().fit(z, w=w, g=g, corr=corr)
172
180
 
173
- def p_value(self, z, w=None, g=None):
181
+ def p_value(self, z, w=None, g=None, corr=None):
174
182
  """Calculate p-values."""
175
183
  if w is None:
176
184
  w = np.ones_like(z)
177
185
 
186
+ if g is None and corr is not None:
187
+ warnings.warn("Correlation matrix provided without groups. Ignoring.")
188
+
189
+ if g is not None and corr is not None and g.shape[0] != corr.shape[0]:
190
+ raise ValueError("Group labels must have the same length as the correlation matrix.")
191
+
178
192
  # Calculate the variance inflation term, sum of non-diagonal elements of sigma.
179
- sigma = self._inflation_term(z, w, g) if g is not None else 0
193
+ sigma = self._inflation_term(z, w, g, corr=corr) if g is not None else 0
180
194
 
181
195
  # The sum of diagonal elements of sigma is given by (w**2).sum(0).
182
196
  variance = (w**2).sum(0) + sigma
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes