Skip to contents

This function transform the input data via z-standardisation. See the Details section below for further information.

Usage

zStandardisationForMatrix(
  x,
  robust = FALSE,
  by = c("rows", "cols"),
  na.rm = TRUE
)

Arguments

x

numerical matrix, features-by-samples.

robust

logical, whether to compute a robust z-standardisation.

by

character string, indicating whether to compute the standardisation by rows or columns of x.

na.rm

logical, whether to remove NA values before the computation.

Details

The z-standardisation (or z-score normalisation) is a method for transforming the data so that it has a mean of zero and a standard deviation of one. It is computed as:

$$z(x) = \frac{x - \mu}{\sigma}$$

where \(\mu\) and \(\sigma\) are the mean and standard deviation of the population, respectively.

Since z-scores can be affected by unusually large or small data values, we can also compute a more robust modified version as:

$$z(x) = \frac{x - \mathrm{median}}{\mathrm{MAD}}$$

where \(\mathrm{MAD}\) is the median absolute deviation of the population.

References

https://en.wikipedia.org/wiki/Standard_score

Author

Alessandro Barberis