View source: R/meanNormalization.R
meanNormalization | R Documentation |
Normalizes each row of a matrix by dividing its elements by the row mean, ignoring NA
values.
This step is commonly used to adjust for global intensity differences across subjects before
applying statistical comparisons or functional data analysis.
meanNormalization(
matrixData,
handleInvalidRows = c("warn", "error", "omit"),
returnDetails = FALSE,
quiet = FALSE
)
matrixData |
A |
handleInvalidRows |
|
returnDetails |
|
quiet |
|
The function performs the following steps
Computes the row means of the input matrix, ignoring NA
s.
Divides each row by its corresponding mean.
Replaces NaN
values (from division by 0) with 0
if applicable.
Handles problematic rows according to the selected handleInvalidRows
option:
"warn"
(default) issues a warning, "error"
stops execution,
and "omit"
removes the affected rows from the result.
This step is often used prior to applying SCC methods to ensure comparability across subjects.
A normalized matrix, or a list if returnDetails = TRUE
.
normalizedMatrix
– The normalized matrix.
problemRows
– Indices of rows that had zero or NA
means.
matrixCreator
for building the matrix input to normalize.
# Generate a minimal database and create a matrix (1 control subject)
dataDir <- system.file("extdata", package = "neuroSCC")
controlPattern <- "^syntheticControl1\\.nii\\.gz$"
databaseControls <- databaseCreator(pattern = controlPattern,
control = TRUE,
quiet = TRUE)
matrixControls <- matrixCreator(databaseControls, paramZ = 35, quiet = TRUE)
# Normalize the matrix (with diagnostics)
normalizationResult <- meanNormalization(matrixControls,
returnDetails = TRUE,
quiet = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.