Reduce across subjects (meta-analysis)
Arguments
- x
A
gds_plan,gds_source, or realisedgds- method
Reduction method. Built-ins include
"fixed","random","stouffer", and"fisher". Registry-backed reducers include meta-analytic regression reducers such as"meta:fe_reg"and the restricted repeated-measures Gaussian LMM reducers"lmm:ri","lmm:ri_slope1","lmm:ri_knownvar", and"lmm:ri_slope1_knownvar", plus permutation reducers"perm:onesample"and"perm:twosample".- weights
Weighting scheme (
"1/var","n_eff","equal","custom"). Registered reducers apply their own weighting, so only the default"1/var"is accepted for every reducer."equal"is accepted for unweighted and evidence-combining reducers (e.g."ols:voxelwise","stouffer"); other schemes raise an error unless the reducer lists them inoptions_schema$weights. Unknownmethodnames also raise an error.- by
Grouping variable (e.g.,
"contrast")- options
Additional reducer options. Common examples include
tau2 = NULL,custom_weights, or for restricted LMM reducerslist(fit = "REML", theta_mode = "pooled")pluslist(slope = "time", covariance = "diag")for"lmm:ri_slope1".Note: Current grouping is per-contrast. Values other than "contrast" are not interpreted yet; future versions may extend grouping to other factors in
row_data/col_data.Restricted repeated-measures LMM contract:
"lmm:ri"fits a Gaussian random-intercept model."lmm:ri_slope1"fits a Gaussian random intercept plus one within-subject slope.The corresponding
*_knownvarmethods add the known diagonal sampling variance fromvarplus an estimated residual heterogeneity component.Repeated-measure metadata must live on the contrast axis via
with_contrast_data()or tabular ingestion withgds(..., contrast_data_cols = ...).Unweighted methods allow
theta_mode = "pooled"or"voxelwise"; known-variance methods currently require"voxelwise".The supported family is intentionally narrow: one grouping factor only, Gaussian responses only, and no general random-effects formula grammar.
Permutation reducer contract:
"perm:onesample"performs an unweighted one-sample sign-flip t test for each sample and contrast."perm:twosample"performs an unweighted two-sample label-permutation t test. It can infer the tested two-level group column fromformulaandcol_data, or useoptions$groupdirectly.Common options include
n_perm,seed,alternative, and for"perm:twosample"variance = "welch"or"pooled".Outputs include
t_g, parametricp_g, permutationp_perm, and max-|t| family-wisep_fwer.
- formula
Optional model formula. For meta-regression reducers the design is built from subject-level
col_data. For repeated-measures LMM reducers, the formula specifies fixed effects at the subject-by-repeat level and must not containlmer-style random-effects syntax.- data
Optional subject-keyed data frame to attach as
col_databefore execution-time construction of the model matrix.
Details
reduce() always works on a lazy plan internally, so x is whichever stage
of the fmrigds workflow you already have:
Start from files or another external source with
gds(). That returns agds_planyou can pipe directly intoreduce().Start from an in-memory result with a realised
gdsreturned bycompute()or created directly withnew_gds().reduce()will convert it withas_plan()for you.You can also pass a low-level
gds_sourcecreated bygds_source(), but most users do not need this becausegds()creates the source binding automatically.
If you want that conversion to be explicit, use as_plan()
before calling reduce().
For worked examples, see vignette("fmrigds") for the basic source -> plan
-> compute workflow and vignette("as-plan-and-spatial-fdr") for chaining
verbs on realised GDS objects.
Output assays
Reducers collapse the subject axis and write group-level assays (named on the
realised GDS, retrievable with assays()/assay()):
"ols:voxelwise": per-termcoef:<term>,se_coef:<term>,t_coef:<term>,p_coef:<term>, plussigma2,df_res,n_obs(see reducer-ols-voxelwise)."fixed"/"meta:fe"and"random"/"meta:re":beta_g,var_g,se_g,z_g,p_g,Q,I2,n_eff(random-effects also addstau2).n_effis the number of finite subject-level inputs used for each sample and contrast."meta:fe_reg"/"meta:re_reg": per-termcoef:<term>,se_coef:<term>, normal-approximationz_coef:<term>andp_coef:<term>, plusQ,df_res(random-effects also addstau2)."meta:re_reg"uses the DerSimonian–Laird meta-regression denominator \(\mathrm{tr}\{W - WX(X^T W X)^{-1}X^T W\}\) and excludes rows with non-finite effects/design values or non-finite, nonpositive variances."stouffer"/"combine:stouffer":z_g,p_g."fisher"/"combine:fisher"and"combine:lancaster":chi2,df,p_g."perm:onesample"/"perm:twosample":beta_g,se_g,t_g,df,p_g,p_perm,p_fwer.