The STANDARDIZE function computes standardized variables from an array of m variables (columns) and n observations (rows).
This routine is written in the IDL language. Its source code can be found in the file standardize.pro in the lib subdirectory of the IDL distribution.
Examples
array = $
[[19.5, 43.1, 29.1, 11.9], $
[24.7, 49.8, 28.2, 22.8], $
[30.7, 51.9, 37.0, 18.7], $
[29.8, 54.3, 31.1, 20.1], $
[19.1, 42.2, 30.9, 12.9], $
[25.6, 53.9, 23.7, 21.7], $
[31.4, 58.5, 27.6, 27.1], $
[27.9, 52.1, 30.6, 25.4], $
[22.1, 49.9, 23.2, 21.3], $
[25.5, 53.5, 24.8, 19.3], $
[31.1, 56.6, 30.0, 25.4], $
[30.4, 56.7, 28.3, 27.2], $
[18.7, 46.5, 23.0, 11.7], $
[19.7, 44.2, 28.6, 17.8], $
[14.6, 42.7, 21.3, 12.8], $
[29.5, 54.4, 30.1, 23.9], $
[27.7, 55.3, 25.7, 22.6], $
[30.2, 58.6, 24.6, 25.4], $
[22.7, 48.2, 27.1, 14.8], $
[25.2, 51.0, 27.5, 21.1]]
Then do the computations and print the results:
FOR K = 0, 3 DO PRINT, MOMENT(array[K,*])
result = STANDARDIZE(array)
FOR K = 0, 3 DO PRINT, MOMENT(result[K,*])
IDL prints:
25.3050 25.2331 -0.454763 -1.10028
51.1700 27.4012 -0.356958 -1.19516
27.6200 13.3017 0.420289 0.104912
20.1950 26.0731 -0.363277 -1.24886
-7.67130e-07 1.00000 -0.454761 -1.10028
-3.65451e-07 1.00000 -0.356958 -1.19516
-1.66707e-07 1.00000 0.420290 0.104913
4.21703e-07 1.00000 -0.363278 -1.24886
Syntax
Result = STANDARDIZE( A [, /DOUBLE] [, /MEAN=variable] [,/ STDDEV=variable)
Return Value
The result is an m-column, n-row array where all columns have a mean of zero and a variance of one.
Arguments
A
An m-column, n-row single- or double-precision floating-point array.
Keywords
DOUBLE
Set this keyword to force the computation to be done in double-precision arithmetic.
MEAN
Set this keyword to a named variable to return an m-element vector containing the mean of each column of data.
STDDEV
Set this keyword to a named variable to return a m-element vector containing the standard deviation of each column of data.
Version History
5.0 |
Introduced |
8.3 |
Added MEAN and STDDEV keywords |
See Also
MOMENT