Skip to contents

This function standardizes the given matrix by centering the columns and scaling them to have unit variance.

Usage

StdMat(X)

Arguments

X

Numeric matrix. The matrix to be standardized.

Value

Numeric matrix with standardized values.

Author

Ivan Jacob Agaloos Pesigan

Examples

std <- StdMat(dat_p2)
colMeans(std)
#> [1]  1.191462e-15 -6.158789e-16 -5.573014e-15
var(std)
#>             [,1]        [,2]       [,3]
#> [1,]  1.00000000 -0.02064809 0.01776756
#> [2,] -0.02064809  1.00000000 0.01682606
#> [3,]  0.01776756  0.01682606 1.00000000