GNU Octave Manual Version 3by John W. Eaton, David Bateman, Søren Hauberg Paperback (6"x9"), 568 pages ISBN 095461206X RRP £24.95 ($39.95) |

## 24.1 Descriptive Statistics

Octave can compute various statistics such as the moments of a data set.

__Function File:__**mean***(*`x`,`dim`,`opt`)- If
`x`is a vector, compute the mean of the elements of`x`mean (x) = SUM_i x(i) / N

If

`x`is a matrix, compute the mean for each column and return them in a row vector.With the optional argument

`opt`, the kind of mean computed can be selected. The following options are recognized:`"a"`

- Compute the (ordinary) arithmetic mean. This is the default.
`"g"`

- Compute the geometric mean.
`"h"`

- Compute the harmonic mean.

If the optional argument

`dim`is supplied, work along dimension`dim`.Both

`dim`and`opt`are optional. If both are supplied, either may appear first.

__Function File:__**median***(*`x`,`dim`)- If
`x`is a vector, compute the median value of the elements of`x`. If the elements of`x`are sorted, the median is defined asx(ceil(N/2)), N odd median(x) = (x(N/2) + x((N/2)+1))/2, N even

If

`x`is a matrix, compute the median value for each column and return them in a row vector. If the optional`dim`argument is given, operate along this dimension.See also std, mean

__Function File:__**meansq***(*`x`)__Function File:__**meansq***(*`x`,`dim`)- For vector arguments, return the mean square of the values.
For matrix arguments, return a row vector containing the mean square
of each column. With the optional
`dim`argument, returns the mean squared of the values along this dimension.

__Function File:__**std***(*`x`)__Function File:__**std***(*`x`,`opt`)__Function File:__**std***(*`x`,`opt`,`dim`)- If
`x`is a vector, compute the standard deviation of the elements of`x`.std (x) = sqrt (sumsq (x - mean (x)) / (n - 1))

If

`x`is a matrix, compute the standard deviation for each column and return them in a row vector.The argument

`opt`determines the type of normalization to use. Valid values are- 0:
- normalizes with N-1, provides the square root of best unbiased estimator of the variance [default]
- 1:
- normalizes with N, this provides the square root of the second moment around the mean

The third argument

`dim`determines the dimension along which the standard deviation is calculated.See also mean, median

__Function File:__**var***(*`x`)- For vector arguments, return the (real) variance of the values.
For matrix arguments, return a row vector containing the variance for
each column.
The argument

`opt`determines the type of normalization to use. Valid values are- 0:
- Normalizes with N-1, provides the best unbiased estimator of the variance [default].
- 1:
- Normalizes with N, this provides the second moment around the mean.

The third argument

`dim`determines the dimension along which the variance is calculated.

__Function File:__[`m`,`f`,`c`] =**mode***(*`x`,`dim`)- Count the most frequently appearing value.
`mode`

counts the frequency along the first non-singleton dimension and if two or more values have te same frequency returns the smallest of the two in`m`. The dimension along which to count can be specified by the`dim`parameter.The variable

`f`counts the frequency of each of the most frequently occurring elements. The cell array`c`contains all of the elements with the maximum frequency .

__Function File:__**cov***(*`x`,`y`)- Compute covariance.
If each row of

`x`and`y`is an observation and each column is a variable, the (`i`,`j`)-th entry of`cov (`

is the covariance between the`x`,`y`)`i`-th variable in`x`and the`j`-th variable in`y`. If called with one argument, compute`cov (`

.`x`,`x`)

__Function File:__**cor***(*`x`,`y`)- Compute correlation.
The (

`i`,`j`)-th entry of`cor (`

is the correlation between the`x`,`y`)`i`-th variable in`x`and the`j`-th variable in`y`.corrcoef(x,y) = cov(x,y)/(std(x)*std(y))

For matrices, each row is an observation and each column a variable; vectors are always observations and may be row or column vectors.

`cor (`

is equivalent to`x`)`cor (`

.`x`,`x`)Note that the

`corrcoef`

function does the same as`cor`

.

__Function File:__**corrcoef***(*`x`,`y`)- Compute correlation.
If each row of

`x`and`y`is an observation and each column is a variable, the (`i`,`j`)-th entry of`corrcoef (`

is the correlation between the`x`,`y`)`i`-th variable in`x`and the`j`-th variable in`y`.corrcoef(x,y) = cov(x,y)/(std(x)*std(y))

If called with one argument, compute

`corrcoef (`

.`x`,`x`)

__Function File:__**kurtosis***(*`x`,`dim`)- If
`x`is a vector of length N, return the kurtosiskurtosis (x) = N^(-1) std(x)^(-4) sum ((x - mean(x)).^4) - 3

If

`x`is a matrix, return the kurtosis over the first non-singleton dimension. The optional argument`dim`can be given to force the kurtosis to be given over that dimension.

__Function File:__**skewness***(*`x`,`dim`)- If
`x`is a vector of length n, return the skewnessskewness (x) = N^(-1) std(x)^(-3) sum ((x - mean(x)).^3)

If

`x`is a matrix, return the skewness along the first non-singleton dimension of the matrix. If the optional`dim`argument is given, operate along this dimension.

__Function File:__**statistics***(*`x`)- If
`x`is a matrix, return a matrix with the minimum, first quartile, median, third quartile, maximum, mean, standard deviation, skewness and kurtosis of the columns of`x`as its rows.If

`x`is a vector, treat it as a column vector.

__Function File:__**moment***(*`x`,`p`,`opt`,`dim`)- If
`x`is a vector, compute the`p`-th moment of`x`.If

`x`is a matrix, return the row vector containing the`p`-th moment of each column.With the optional string opt, the kind of moment to be computed can be specified. If opt contains

`"c"`

or`"a"`

, central and/or absolute moments are returned. For example,moment (x, 3, "ac")

computes the third central absolute moment of

`x`.If the optional argument

`dim`is supplied, work along dimension`dim`.

ISBN 095461206X | GNU Octave Manual Version 3 | See the print edition |