Computes the DSE decomposition and DVARS-related statistics. Based on code from github.com/asoroosh/DVARS .

DVARS(
  X,
  normalize = TRUE,
  cutoff_DPD = 5,
  cutoff_ZD = qnorm(1 - 0.05/nrow(as.matrix2(X))),
  verbose = FALSE
)

Arguments

X

a \(T\) by \(N\) numeric matrix representing an fMRI run. There should not be any missing data (NA or NaN).

normalize

Normalize the data as proposed in the paper? Default: TRUE. Normalization removes constant-zero voxels, scales by 100 / the median of the mean image, and then centers each voxel on its mean.

To replicate Afyouni and Nichols' procedure for the HCP MPP data, since the HCP scans are already normalized to 10,000, just divide the data by 100 and center the voxels on their means:

Y <- Y/100; DVARS(t(Y - apply(Y, 1, mean))) where Y is the \(V\) by \(T\) data matrix.

Note that while voxel centering doesn't affect DVARS, it does affect DPD and ZD.

cutoff_DPD, cutoff_ZD

Numeric outlier cutoffs. Timepoints exceeding these cutoffs will be flagged as outliers.

verbose

Should occasional updates be printed? Default is FALSE.

Value

A list with components

measure

A data.frame with \(T\) rows, each column being a different variant of DVARS.

measure_info

"DVARS"

outlier_cutoff

The outlier cutoff value(s).

outlier_flag

A logical data.frame with \(T\) rows, where TRUE indicates suspected outlier presence.

References

  • Afyouni, S. & Nichols, T. E. Insight and inference for DVARS. NeuroImage 172, 291-312 (2018).