1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
@c Copyright (C) 1996, 1997 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.texi.
@node Statistics, Sets, Optimization, Top
@chapter Statistics
I hope that someday Octave will include more statistics functions. If
you would like to help improve Octave in this area, please contact
@email{bug-octave@@bevo.che.wisc.edu}.
@deftypefn {Function File} {} mean (@var{x})
If @var{x} is a vector, compute the mean of the elements of @var{x}
@iftex
@tex
$$ {\rm mean}(x) = \bar{x} = {1\over N} \sum_{i=1}^N x_i $$
@end tex
@end iftex
@ifinfo
@example
mean (x) = SUM_i x(i) / N
@end example
@end ifinfo
If @var{x} is a matrix, compute the mean for each column and return them
in a row vector.
@end deftypefn
@deftypefn {Function File} {} median (@var{x})
If @var{x} is a vector, compute the median value of the elements of
@var{x}.
@iftex
@tex
$$
{\rm median} (x) =
\cases{x(\lceil N/2\rceil), & $N$ odd;\cr
(x(N/2)+x(N/2+1))/2, & $N$ even.}
$$
@end tex
@end iftex
@ifinfo
@example
@group
x(ceil(N/2)), N odd
median(x) =
(x(N/2) + x((N/2)+1))/2, N even
@end group
@end example
@end ifinfo
If @var{x} is a matrix, compute the median value for each
column and return them in a row vector.
@end deftypefn
@deftypefn {Function File} {} std (@var{x})
If @var{x} is a vector, compute the standard deviation of the elements
of @var{x}.
@iftex
@tex
$$
{\rm std} (x) = \sigma (x) = \sqrt{{\sum_{i=1}^N (x_i - \bar{x}) \over N - 1}}
$$
@end tex
@end iftex
@ifinfo
@example
@group
std (x) = sqrt (sumsq (x - mean (x)) / (n - 1))
@end group
@end example
@end ifinfo
If @var{x} is a matrix, compute the standard deviation for
each column and return them in a row vector.
@end deftypefn
@deftypefn {Function File} {} cov (@var{x}, @var{y})
If each row of @var{x} and @var{y} is an observation and each column is
a variable, the (@var{i},@var{j})-th entry of
@code{cov (@var{x}, @var{y})} is the covariance between the @var{i}-th
variable in @var{x} and the @var{j}-th variable in @var{y}. If called
with one argument, compute @code{cov (@var{x}, @var{x})}.
@end deftypefn
@deftypefn {Function File} {} corrcoef (@var{x}, @var{y})
If each row of @var{x} and @var{y} is an observation and each column is
a variable, the (@var{i},@var{j})-th entry of
@code{corrcoef (@var{x}, @var{y})} is the correlation between the
@var{i}-th variable in @var{x} and the @var{j}-th variable in @var{y}.
If called with one argument, compute @code{corrcoef (@var{x}, @var{x})}.
@end deftypefn
@deftypefn {Function File} {} kurtosis (@var{x})
If @var{x} is a vector of length @var{N}, return the kurtosis
@iftex
@tex
$$
{\rm kurtosis} (x) = {1\over N \sigma(x)^4} \sum_{i=1}^N (x_i-\bar{x})^4 - 3
$$
@end tex
@end iftex
@ifinfo
@example
kurtosis (x) = N^(-1) std(x)^(-4) sum ((x - mean(x)).^4) - 3
@end example
@end ifinfo
@noindent
of @var{x}. If @var{x} is a matrix, return the row vector containing
the kurtosis of each column.
@end deftypefn
@deftypefn {Function File} {} mahalanobis (@var{x}, @var{y})
Return the Mahalanobis' D-square distance between the multivariate
samples @var{x} and @var{y}, which must have the same number of
components (columns), but may have a different number of observations
(rows).
@end deftypefn
@deftypefn {Function File} {} skewness (@var{x})
If @var{x} is a vector of length @var{N}, return the skewness
@iftex
@tex
$$
{\rm skewness} (x) = {1\over N \sigma(x)^3} \sum_{i=1}^N (x_i-\bar{x})^3
$$
@end tex
@end iftex
@ifinfo
@example
skewness (x) = N^(-1) std(x)^(-3) sum ((x - mean(x)).^3)
@end example
@end ifinfo
@noindent
of @var{x}. If @var{x} is a matrix, return the row vector containing
the skewness of each column.
@end deftypefn
|