<< mps_stdev Statistics Trigonometric functions >>

mpscilab >> mpscilab > Statistics > mps_variance

mps_variance

Variance of a vector/matrix entries

Calling Sequence

mps_variance( rop, op [,orientation] [, w] )
rop = mps_variance( rop, op [,orientation] [, w] )

Arguments

rop

multi-precision matrix

op

Multi-precision matrix

op

Scalar integer (1 or 0)

Description

Computes the variance of a matrix's elements. The option argument w can be used to select the normalization factor. With w = 1, the default, the result is normalized with N - 1 with N being the number of elements used in the variance estimation. Otherwise with w = 0, the result is normalized with N.

mps_variance( rop, op [, orientation] [, w] )

Computes the variance of all of the elements of op along the specified orientation and returns the result in rop. The orientation is specified as a single character either '*', 'r' and 'c' respectively for row, column and whole matrix.

rop = mps_variance( op [, orientation] [, w] )

Creates a multi-precision matrix of the correct size and with the same precision as op containing the result.

Usage notes

The variance is evaluated using a corrected two-pass algorithm minimizing the loss of precision.

Examples

// Variance of a matrix.
A = [1 2; 3 4]
mpsA = mps_init2(A,100)
rop = mps_init(1,1,100)
rop = mps_variance(op)

// Variance of each rows of a matrix.
A = [1 2; 3 4]
mpsA = mps_init2(A,100)
rop = mps_init(2,1,100)
mps_variance(rop,op,'r')

//Variance using N instead of N - 1.
A = [1 2; 3 4]
mpsA = mps_init2(A,100)
rop = mps_init(1,1,100)
mps_variance(rop,op,'*',0)

See Also

<< mps_stdev Statistics Trigonometric functions >>