3200
|
1 ## Copyright (C) 1995, 1996, 1997 Kurt Hornik |
3426
|
2 ## |
3200
|
3 ## This program is free software; you can redistribute it and/or modify |
|
4 ## it under the terms of the GNU General Public License as published by |
|
5 ## the Free Software Foundation; either version 2, or (at your option) |
|
6 ## any later version. |
3426
|
7 ## |
3200
|
8 ## This program is distributed in the hope that it will be useful, but |
|
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3426
|
11 ## General Public License for more details. |
|
12 ## |
3200
|
13 ## You should have received a copy of the GNU General Public License |
|
14 ## along with this file. If not, write to the Free Software Foundation, |
|
15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
16 |
3453
|
17 ## -*- texinfo -*- |
|
18 ## @deftypefn {Function File} {} statistics (@var{x}) |
|
19 ## If @var{x} is a matrix, return a matrix with the minimum, first |
|
20 ## quartile, median, third quartile, maximum, mean, standard deviation, |
|
21 ## skewness and kurtosis of the columns of @var{x} as its rows. |
3200
|
22 ## |
3453
|
23 ## If @var{x} is a vector, treat it as a column vector. |
|
24 ## @end deftypefn |
3426
|
25 |
3200
|
26 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> |
|
27 ## Description: Compute basic statistics |
|
28 |
|
29 function S = statistics (X) |
3426
|
30 |
3200
|
31 if (nargin != 1) |
|
32 usage ("S = statistics (X)"); |
|
33 endif |
|
34 |
|
35 if (prod (size (X)) > 1) |
|
36 if (is_vector (X)) |
|
37 X = reshape (X, length (X), 1); |
|
38 endif |
|
39 for k=1:columns(X) |
3273
|
40 S(:,k) = [(min (X(:,k))); |
3426
|
41 (empirical_inv ([0.25;0.5;0.75], X(:,k))); |
|
42 (max (X(:,k))); |
|
43 (mean (X(:,k))); |
|
44 (std (X(:,k))); |
|
45 (skewness (X(:,k))); |
|
46 (kurtosis (X(:,k)))]; |
|
47 endfor |
3200
|
48 else |
|
49 error ("statistics: invalid argument"); |
|
50 endif |
3426
|
51 |
3200
|
52 endfunction |