Learn R Programming

combat.enigma (version 1.1)

prescale_fit: Fit and apply brain imaging prescaling

Description

Fit and apply a prescaling of magnetic resonance imaging (MRI) data from different sites, especially relevant for fMRI, where different devices can have varying units of measurement.

Usage

prescale_fit(dat, site, cov = NULL, n.min = 10, impute_missing_cov = FALSE,
             verbose = TRUE)
prescale_apply(combat_parameters, dat, site, cov = NULL, verbose = TRUE)

Value

prescale_fit returns a list of parameters for prescale_apply; prescale_apply returns the list of parameters plus the prescaled data (item dat.combat)

Arguments

dat

matrix or data.frame with the MRI data (e.g., ROIs, voxels, vertexes, etc.).

site

factor specifying the site of each individual.

cov

matrix or data.frame with the covariates.

combat_parameters

a list of combat parameters returned by prescale_fit.

n.min

(optional) number specifying the minimum size of a site to be analyzed.

impute_missing_cov

(optional) logical, whether to impute missing covariates.

verbose

(optional) logical, whether to print some messages during execution.

Author

Joaquim Radua

Details

prescale_fit function finds a prescaling parameter for each site so that, after calling prescale_apply, the voxelwise-median standard deviation after removing the effects of covariates is 1 (in the training data, but it might not be the case in new data).

References

Neural correlates of human fear conditioning and sources of variability: A mega-analysis and normative modeling study of fMRI data from 2,199 individuals, submitted.

See Also

combat_fit, and lmm_fit

Examples

Run this code
raw_mri = combat_example[,6:19]
site = factor(combat_example$site)

# Fit and apply prescale to prescale mri data across sites
mod = as.matrix(combat_example[,c("disorder", "age", "sex")])
prescaling = prescale_fit(raw_mri, site, mod)
prescaled_mri = prescale_apply(prescaling, raw_mri, site, mod)$dat.combat

Run the code above in your browser using DataLab