Mercurial > hg > octave-nkf
comparison scripts/statistics/base/studentize.m @ 3456:434790acb067
[project @ 2000-01-19 06:58:51 by jwe]
author | jwe |
---|---|
date | Wed, 19 Jan 2000 06:59:23 +0000 |
parents | 71d2e09c15a2 |
children | d25bc039237b |
comparison
equal
deleted
inserted
replaced
3455:f758be6e1730 | 3456:434790acb067 |
---|---|
20 ## deviation. | 20 ## deviation. |
21 ## | 21 ## |
22 ## If @var{x} is a matrix, do the above for each column. | 22 ## If @var{x} is a matrix, do the above for each column. |
23 ## @end deftypefn | 23 ## @end deftypefn |
24 | 24 |
25 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> | 25 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> |
26 ## Description: Subtract mean and divide by standard deviation | 26 ## Description: Subtract mean and divide by standard deviation |
27 | 27 |
28 function t = studentize (x) | 28 function t = studentize (x) |
29 | 29 |
30 if (nargin != 1) | 30 if (nargin != 1) |
31 usage ("studentize (x)"); | 31 usage ("studentize (x)"); |
40 elseif is_matrix (x) | 40 elseif is_matrix (x) |
41 l = ones (rows (x), 1); | 41 l = ones (rows (x), 1); |
42 t = x - l * mean (x); | 42 t = x - l * mean (x); |
43 t = t ./ (l * max ([(std (t)); (! any (t))])); | 43 t = t ./ (l * max ([(std (t)); (! any (t))])); |
44 else | 44 else |
45 error ("studentize: x must be a vector or a matrix."); | 45 error ("studentize: x must be a vector or a matrix."); |
46 endif | 46 endif |
47 | 47 |
48 endfunction | 48 endfunction |