The known mean of the underlying statistical distribution law (assuming that it is known).

"*" mode (default): m must be scalar

"r" or 1 mode: m is a row of length size(x,2). The variance along the column #j is computed using m(j) as the mean for the considered column. If m(j) is the same for all columns, it can be provided as a scalar m.

"c" or 2 mode: m is a column of length size(x,1). The variance along the row #i is computed using m(i) as the mean for the considered row. If m(i) is the same for all rows, it can be provided as a scalar m.

When m is not provided, the variance is built dividing the quadratic distance of n values to mean(x) (or mean(x,"c") or mean(x,"r")) by n-1 (n being length(x) or size(x,1) or size(x,2)). If the elements of x are mutually independent, the result is then statistically unbiased.

Else, the variance is built dividing the quadratic distance of values to m by the number n of considered values (n being length(x) or size(x,1) or size(x,2)).

If a true value m independent from x elements is used, x and m values are mutually independent, and the result is then unbiased.

When the special value m = %nan is provided, the variance is still normalized by n (not n-1) but is computed using
m=mean(x) instead (or m = mean(x,"c") or m = mean(x,"r")). This m does not bring independent information, and yields a statistically biased result.

s

The variance of unweighted values of x elements. It is a scalar or a column vector or a row vector according to orien.

mc

Scalar or orien-wise mean of x elements (unweighted) (= mean(x,..)), as computed before and used as reference in the variance.

Description

This function computes the variance of the real or complex numbers stored into a vector or matrix x. If x is complex, variance(x,..) = variance(real(x),..) + variance(imag(x),..) is returned.

For a vector, a matrix, or a hypermatrix x, s=variance(x)
returns in the scalar s the variance of all the entries of x.

s=variance(x,"c") (or, equivalently, s=variance(x,2))
is the columnwise variance: s is a column vector, with s(j)=variance(x(j,:)).

s=variance(x,"r") (or, equivalently, s=variance(x,1))
is the rowwise variance: s is a row vector, with s(i)=variance(x(:,i)).

The second output argument m is the mean of the input, with respect to the orien parameter.

The variance(x, "*"|"c"|"r", 1) synopsis used only in Scilab 5.4.1 must be replaced with
variance(x, "*"|"c"|"r", %nan). variance(x, "*"|"c"|"r", 1) will warn
the user until Scilab 6.0. Indeed, 1 will be now considered as m=1.
If 1 is the true value provided as m, the warning may be avoided entering 1+%eps instead
of 1.