Next: Tests, Up: Statistics

— Function File: **mean** (`x, dim, opt`)

If

xis a vector, compute the mean of the elements ofxmean (x) = SUM_i x(i) / NIf

xis 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"`

- Computer the geometric mean.
`"h"`

- Compute the harmonic mean.
If the optional argument

dimis supplied, work along dimensiondim.Both

dimandoptare optional. If both are supplied, either may appear first.

— Function File: **median** (`x`)

If

xis a vector, compute the median value of the elements ofx.x(ceil(N/2)), N odd median(x) = (x(N/2) + x((N/2)+1))/2, N evenIf

xis a matrix, compute the median value for each column and return them in a row vector.

— Function File: **std** (`x`)

— Function File:**std** (`x, opt`)

— Function File:**std** (`x, opt, dim`)

— Function File:

— Function File:

If

xis a vector, compute the standard deviation of the elements ofx.std (x) = sqrt (sumsq (x - mean (x)) / (n - 1))If

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

optdetermines 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

dimdetermines the dimension along which the standard deviation is calculated.

— Function File: **cov** (`x, y`)

If each row of

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

x`,`

y`)`

is the covariance between thei-th variable inxand thej-th variable iny. If called with one argument, compute`cov (`

x`,`

x`)`

.

— Function File: **corrcoef** (`x, y`)

If each row of

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

x`,`

y`)`

is the correlation between thei-th variable inxand thej-th variable iny. If called with one argument, compute`corrcoef (`

x`,`

x`)`

.

— Function File: **kurtosis** (`x, dim`)

If

xis a vector of length N, return the kurtosiskurtosis (x) = N^(-1) std(x)^(-4) sum ((x - mean(x)).^4) - 3of

x. Ifxis a matrix, return the kurtosis over the first non-singleton dimension. The optional argumentdimcan be given to force the kurtosis to be given over that dimension.

— Function File: **mahalanobis** (`x, y`)

Return the Mahalanobis' D-square distance between the multivariate samples

xandy, which must have the same number of components (columns), but may have a different number of observations (rows).

— Function File: **skewness** (`x, dim`)

If

xis a vector of length n, return the skewnessskewness (x) = N^(-1) std(x)^(-3) sum ((x - mean(x)).^3)of

x. Ifxis a matrix, return the skewness along the first non-singleton dimension of the matrix. If the optionaldimargument is given, operate along this dimension.

— Function File: **values** (`x`)

Return the different values in a column vector, arranged in ascending order.

— Function File: **var** (`x`)

For vector arguments, return the (real) variance of the values. For matrix arguments, return a row vector contaning the variance for each column.

The argument

optdetermines 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

dimdetermines the dimension along which the variance is calculated.

— Function File: [`t`, `l_x`] = **table** (`x`)

— Function File: [`t`, `l_x`, `l_y`] = **table** (`x, y`)

— Function File: [

Create a contingency table

tfrom data vectors. Thelvectors are the corresponding levels.Currently, only 1- and 2-dimensional tables are supported.

— Function File: **studentize** (`x, dim`)

If

xis a vector, subtract its mean and divide by its standard deviation.If

xis a matrix, do the above along the first non-singleton dimension. If the optional argumentdimis given then operate along this dimension.

— Function File: **statistics** (`x`)

If

xis a matrix, return a matrix with the minimum, first quartile, median, third quartile, maximum, mean, standard deviation, skewness and kurtosis of the columns ofxas its rows.If

xis a vector, treat it as a column vector.

— Function File: **spearman** (`x, y`)

Compute Spearman's rank correlation coefficient

rhofor each of the variables specified by the input arguments.For matrices, each row is an observation and each column a variable; vectors are always observations and may be row or column vectors.

`spearman (`

x`)`

is equivalent to`spearman (`

x`,`

x`)`

.For two data vectors

xandy, Spearman'srhois the correlation of the ranks ofxandy.If

xandyare drawn from independent distributions,rhohas zero mean and variance`1 / (n - 1)`

, and is asymptotically normally distributed.

— Function File: **run_count** (`x, n`)

Count the upward runs along the first non-singleton dimension of

xof length 1, 2, ...,n-1 and greater than or equal ton. If the optional argumentdimis given operate along this dimension

— Function File: **ranks** (`x, dim`)

If

xis a vector, return the (column) vector of ranks ofxadjusted for ties.If

xis a matrix, do the above for along the first non-singleton dimension. If the optional argumentdimis given, operate along this dimension.

— Function File: **range** (`x`)

— Function File:**range** (`x, dim`)

— Function File:

If

xis a vector, return the range, i.e., the difference between the maximum and the minimum, of the input data.If

xis a matrix, do the above for each column ofx.If the optional argument

dimis supplied, work along dimensiondim.

— Function File: [`q`, `s`] = **qqplot** (`x, dist, params`)

Perform a QQ-plot (quantile plot).

If F is the CDF of the distribution

distwith parametersparamsand G its inverse, andxa sample vector of lengthn, the QQ-plot graphs ordinates(i) =i-th largest element of x versus abscissaq(if) = G((i- 0.5)/n).If the sample comes from F except for a transformation of location and scale, the pairs will approximately follow a straight line.

The default for

distis the standard normal distribution. The optional argumentparamscontains a list of parameters ofdist. For example, for a quantile plot of the uniform distribution on [2,4] andx, useqqplot (x, "uniform", 2, 4)If no output arguments are given, the data are plotted directly.

— Function File: **probit** (`p`)

For each component of

p, return the probit (the quantile of the standard normal distribution) ofp.

— Function File: [`p`, `y`] = **ppplot** (`x, dist, params`)

Perform a PP-plot (probability plot).

If F is the CDF of the distribution

distwith parametersparamsandxa sample vector of lengthn, the PP-plot graphs ordinatey(i) = F (i-th largest element ofx) versus abscissap(i) = (i- 0.5)/n. If the sample comes from F, the pairs will approximately follow a straight line.The default for

distis the standard normal distribution. The optional argumentparamscontains a list of parameters ofdist. For example, for a probability plot of the uniform distribution on [2,4] andx, useppplot (x, "uniform", 2, 4)If no output arguments are given, the data are plotted directly.

— Function File: **moment** (`x, p, opt, dim`)

If

xis a vector, compute thep-th moment ofx.If

xis a matrix, return the row vector containing thep-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

dimis supplied, work along dimensiondim.

— Function File: **meansq** (`x`)

— Function File:**meansq** (`x, dim`)

— Function File:

For vector arguments, return the mean square of the values. For matrix arguments, return a row vector contaning the mean square of each column. With the optional

dimargument, returns the mean squared of the values along this dimension

— Function File: **kendall** (`x, y`)

Compute Kendall's

taufor each of the variables specified by the input arguments.For matrices, each row is an observation and each column a variable; vectors are always observations and may be row or column vectors.

`kendall (`

x`)`

is equivalent to`kendall (`

x`,`

x`)`

.For two data vectors

x,yof common lengthn, Kendall'stauis the correlation of the signs of all rank differences ofxandy; i.e., if bothxandyhave distinct entries, then1 tau = ------- SUM sign (q(i) - q(j)) * sign (r(i) - r(j)) n (n-1) i,jin which the

q(i) andr(i) are the ranks ofxandy, respectively.If

xandyare drawn from independent distributions, Kendall'stauis asymptotically normal with mean 0 and variance`(2 * (2`

n`+5)) / (9 *`

n`* (`

n`-1))`

.

— Function File: **iqr** (`x, dim`)

If

xis a vector, return the interquartile range, i.e., the difference between the upper and lower quartile, of the input data.If

xis a matrix, do the above for first non singleton dimension ofx.. If the optiondimargument is given, then operate along this dimension.

— Function File: **cut** (`x, breaks`)

Create categorical data out of numerical or continuous data by cutting into intervals.

If

breaksis a scalar, the data is cut into that many equal-width intervals. Ifbreaksis a vector of break points, the category has`length (`

breaks`) - 1`

groups.The returned value is a vector of the same size as

xtelling which group each point inxbelongs to. Groups are labelled from 1 to the number of groups; points outside the range ofbreaksare labelled by`NaN`

.

— Function File: **cor** (`x, y`)

The (

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

x`,`

y`)`

is the correlation between thei-th variable inxand thej-th variable iny.For matrices, each row is an observation and each column a variable; vectors are always observations and may be row or column vectors.

`cor (`

x`)`

is equivalent to`cor (`

x`,`

x`)`

.