Convenience function that computes DVARS and converts to weights in one step. This is the main user-facing function for volume quality weighting.
Value
If return_dvars is FALSE, a numeric vector of weights. If TRUE, a list with components "weights" and "dvars".
Examples
set.seed(123)
Y <- matrix(rnorm(100 * 50), nrow = 100, ncol = 50)
Y[50, ] <- Y[50, ] + 5 # Add artifact
# One-step computation of weights
result <- volume_weights(Y, return_dvars = TRUE)
cat("DVARS at artifact:", round(result$dvars[50], 2), "\n")
#> DVARS at artifact: 3.38
cat("Weight at artifact:", round(result$weights[50], 3), "\n")
#> Weight at artifact: 0.163
# With Tukey method for more aggressive downweighting
w_tukey <- volume_weights(Y, method = "tukey")