Centers and scales the columns of a matrix robustly for the purpose of covariance estimation.

scale_med(mat)

Arguments

mat

A numerical matrix.

Value

The input matrix with its columns centered and scaled.

Details

Centers each column on its median, and scales each column by its median absolute deviation (MAD). If any column MAD is zero, its values become zero and a warning is raised. If all MADs are zero, an error is raised.