|
1 | 1 | r""" |
2 | 2 | .. _metas_cbmr: |
3 | | -.. _metas_spatial_cbmr: |
| 3 | +.. _metas_voxelwise_cbmr: |
4 | 4 |
|
5 | 5 | ============================================================ |
6 | 6 | Coordinate-based meta-regression with moderator-effect modes |
|
10 | 10 |
|
11 | 11 | CBMR is a generative framework for estimating smooth activation intensity |
12 | 12 | functions from coordinate-based meta-analytic data. The same |
13 | | -:class:`~nimare.meta.cbmr.CBMREstimator` can parameterize study-level moderator |
14 | | -effects in two ways: |
| 13 | +:class:`~nimare.meta.cbmr.CBMREstimator` can parameterize moderator effects in |
| 14 | +two ways: |
15 | 15 |
|
16 | 16 | * ``moderator_effect="global"`` estimates one scalar coefficient per moderator. |
17 | | - This is the classic CBMR model and answers whether a study-level covariate has |
18 | | - an overall effect on the spatial intensity function. |
19 | | -* ``moderator_effect="voxelwise"`` estimates a smooth map for each moderator. |
20 | | - This spatially varying model asks where the study-level covariate effect is |
21 | | - stronger or weaker over voxels. |
| 17 | + This assumes the effect of the moderator has a global effect across the entire brain. |
| 18 | +* ``moderator_effect="voxelwise"`` estimates a scalar coefficient _per voxel_ per moderator. |
| 19 | + This assumes the effect of the moderator differentially impacts voxels throughout the brain. |
| 20 | + This is likely a more accurate assumption, but requires a lot more data for estimation. |
22 | 21 |
|
23 | 22 | This tutorial fits both versions to the same simulated Studyset with the same |
24 | 23 | groups and the same standardized moderators, then compares their outputs. |
|
37 | 36 | # Load Studyset-compatible data |
38 | 37 | # ----------------------------------------------------------------------------- |
39 | 38 | # We simulate a coordinate-based Studyset with reported foci, sample sizes, |
40 | | -# diagnosis labels, drug-status labels, and continuous study-level moderators. |
| 39 | +# diagnosis labels, drug-status labels, and continuous moderators. |
41 | 40 | # The example uses a moderate number of studies and coarse B-spline spacing so |
42 | 41 | # that both global and voxelwise CBMR fits run quickly. |
43 | 42 |
|
|
67 | 66 | # Option 1: global moderator effects |
68 | 67 | # ----------------------------------------------------------------------------- |
69 | 68 | # With ``moderator_effect="global"``, CBMR estimates group-specific baseline |
70 | | -# spatial intensity functions plus one scalar effect for each study-level |
71 | | -# moderator. Here, ``standardized_sample_sizes`` and ``standardized_avg_age`` |
72 | | -# each receive one global coefficient shared over voxels. |
| 69 | +# spatial intensity functions plus one scalar effect for each moderator. |
| 70 | +# Here, ``standardized_sample_sizes`` and ``standardized_avg_age`` each receive |
| 71 | +# one global coefficient shared over voxels. |
73 | 72 |
|
74 | 73 | global_cbmr = CBMREstimator( |
75 | 74 | moderator_effect="global", |
|
207 | 206 | ############################################################################### |
208 | 207 | # Option 2: voxelwise moderator effects |
209 | 208 | # ----------------------------------------------------------------------------- |
210 | | -# The same estimator exposes spatially varying CBMR through |
| 209 | +# The same estimator exposes voxelwise moderator-effect maps through |
211 | 210 | # ``moderator_effect="voxelwise"``. This option uses the same groups and the same |
212 | | -# standardized moderators as above, but estimates a smooth map for each moderator |
213 | | -# within each group. The approximate backend is used here for speed. |
| 211 | +# standardized moderators as above, but estimates a smooth effect map for each |
| 212 | +# moderator within each group. The approximate backend is used here for speed. |
214 | 213 |
|
215 | 214 | voxelwise_cbmr = CBMREstimator( |
216 | 215 | moderator_effect="voxelwise", |
|
228 | 227 | voxelwise_results = voxelwise_cbmr.fit(dataset=studyset) |
229 | 228 |
|
230 | 229 | print(voxelwise_results.describe_inference_inputs()) |
231 | | -print(voxelwise_results.sv_moderator_names) |
232 | | -print(voxelwise_results.describe_sv_effects()) |
| 230 | +print(voxelwise_results.voxelwise_moderator_effect_map_names) |
| 231 | +print(voxelwise_results.describe_voxelwise_moderator_effect_maps()) |
233 | 232 |
|
234 | 233 | ############################################################################### |
235 | 234 | # Plot voxelwise moderator-effect maps |
|
239 | 238 | # scalar tables. |
240 | 239 |
|
241 | 240 | plot_stat_map( |
242 | | - voxelwise_results.get_map("svModerator_standardized_sample_sizes_group-SchizophreniaYes"), |
| 241 | + voxelwise_results.get_map( |
| 242 | + "voxelwiseModeratorEffect_standardized_sample_sizes_group-SchizophreniaYes" |
| 243 | + ), |
243 | 244 | cut_coords=[0, 0, -8], |
244 | 245 | draw_cross=False, |
245 | 246 | cmap="RdBu_r", |
246 | 247 | symmetric_cbar=True, |
247 | 248 | title="Voxelwise sample-size effect: SchizophreniaYes", |
248 | 249 | ) |
249 | 250 | plot_stat_map( |
250 | | - voxelwise_results.get_map("svModerator_standardized_avg_age_group-SchizophreniaYes"), |
| 251 | + voxelwise_results.get_map( |
| 252 | + "voxelwiseModeratorEffect_standardized_avg_age_group-SchizophreniaYes" |
| 253 | + ), |
251 | 254 | cut_coords=[0, 0, -8], |
252 | 255 | draw_cross=False, |
253 | 256 | cmap="RdBu_r", |
|
264 | 267 | # Fisher information standard errors can be requested with ``method="FI"``. |
265 | 268 |
|
266 | 269 | voxelwise_moderator_result = voxelwise_results.test_moderators(method="sandwich") |
267 | | -print(voxelwise_moderator_result.metadata["spatial_cbmr_inference_method"]) |
| 270 | +print(voxelwise_moderator_result.metadata["voxelwise_cbmr_inference_method"]) |
268 | 271 |
|
269 | 272 | plot_stat_map( |
270 | 273 | voxelwise_moderator_result.get_map( |
271 | | - "z_svModerator_standardized_sample_sizes_group-SchizophreniaYes" |
| 274 | + "z_voxelwiseModeratorEffect_standardized_sample_sizes_group-SchizophreniaYes" |
272 | 275 | ), |
273 | 276 | cut_coords=[0, 0, -8], |
274 | 277 | draw_cross=False, |
|
285 | 288 |
|
286 | 289 | plot_stat_map( |
287 | 290 | voxelwise_moderator_comparison.get_map( |
288 | | - "z_svModerator_standardized_sample_sizes-standardized_avg_age_group-SchizophreniaYes" |
| 291 | + "z_voxelwiseModeratorEffect_standardized_sample_sizes-standardized_avg_age_group-" |
| 292 | + "SchizophreniaYes" |
289 | 293 | ), |
290 | 294 | cut_coords=[0, 0, -8], |
291 | 295 | draw_cross=False, |
|
299 | 303 | ############################################################################### |
300 | 304 | # Optional inverse-Fisher standard errors for voxelwise CBMR |
301 | 305 | # ----------------------------------------------------------------------------- |
302 | | -# The same voxelwise inference helpers can use inverse Fisher information rather |
303 | | -# than the sandwich estimator. |
| 306 | +# The same voxelwise inference helpers can use inverse Fisher information, but |
| 307 | +# the sandwich estimator is usually the safer default for applied CBMR analyses. |
| 308 | +# Inverse-Fisher standard errors are model-based: they are efficient when the |
| 309 | +# likelihood, mean-variance relationship, and independence assumptions are |
| 310 | +# correctly specified, but can be too optimistic when those assumptions are only |
| 311 | +# approximate. Coordinate-based meta-analytic data often have study-level |
| 312 | +# clustering, heterogeneous reporting practices, and other departures from the |
| 313 | +# idealized Poisson model. Sandwich standard errors use the fitted model for the |
| 314 | +# mean structure while estimating covariance from empirical residual variation, |
| 315 | +# making inference more robust to this kind of model misspecification. |
| 316 | +# |
| 317 | +# For that reason, we recommend keeping ``method="sandwich"`` as the default for |
| 318 | +# primary voxelwise CBMR inference. ``method="FI"`` can still be useful for |
| 319 | +# sensitivity analyses, simulations where the model is known to be correct, or |
| 320 | +# comparisons with fully model-based standard errors. |
304 | 321 |
|
305 | 322 | voxelwise_fi_result = voxelwise_results.test_groups(method="FI") |
306 | | -print(voxelwise_fi_result.metadata["spatial_cbmr_inference_method"]) |
| 323 | +print(voxelwise_fi_result.metadata["voxelwise_cbmr_inference_method"]) |
307 | 324 |
|
308 | 325 | ############################################################################### |
309 | 326 | # Summary |
310 | 327 | # ----------------------------------------------------------------------------- |
311 | 328 | # Use ``moderator_effect="global"`` when the scientific question is whether a |
312 | | -# study-level covariate has an overall effect on activation intensity. Use |
313 | | -# ``moderator_effect="voxelwise"`` when the scientific question is where that |
314 | | -# covariate effect varies across the brain. Both options share the same |
315 | | -# preprocessing, grouping, and result-centered inference interface. |
| 329 | +# moderator has an overall effect on activation intensity. Use ``moderator_effect="voxelwise"`` |
| 330 | +# when the scientific question is where that moderator effect varies across the brain. |
| 331 | +# Both options share the same preprocessing, grouping, and result-centered inference interface. |
0 commit comments