Covariance - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Student[Statistics]

  

Covariance

  

compute the covariance/covariance matrix

 

Calling Sequence

Parameters

Description

Computation

Examples

References

Compatibility

Calling Sequence

Covariance(X, Y, numeric_option, inert_option)

Covariance(A, B, numeric_option)

Covariance(M, numeric_option)

Parameters

X

-

algebraic; random variable

Y

-

algebraic; random variable

A

-

data sample

B

-

data sample

M

-

Matrix data sample

numeric_option

-

(optional) equation of the form numeric=value where value is true or false

inert_option

-

(optional) equation of the form inert=value where value is true or false

Description

• 

The Covariance function computes the covariance of two data samples or the covariance of multiple data samples in a Matrix.

• 

The first parameter can be a data sample (given as e.g. a Vector), a Matrix data sample, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).

• 

If the option inert is not included or is specified to be inert=false, then the function will return the actual value of the result. If inert or inert=true is specified, then the function will return the formula of evaluating the actual value.

Computation

• 

If a computation involves floating point data or the option numeric = true or numeric is specified, then the result is a floating point number. Otherwise, the result is an exact expression.

Examples

withStudentStatistics:

Compute the covariance of two data sets.

A1,4,5,2

A1,4,5,2

(1)

B2,π,sqrt2,4

B2,π,2,4

(2)

CovarianceA,B

83+π3+223

(3)

If numeric is specified, then the result is a floating point.

CovarianceA,B,numeric

−0.676660073888006

(4)

Computations involving undefined values will eventually return an undefined result. Whenever data samples have at most one data point, the covariance is also undefined.

Useq57..77,undefined

Vseqsini,i=57..77,undefined

CovarianceU,V

undefined

(5)

Consider the following Matrix.

MMatrix1,3,10,3,4.1,2,10,π,undefined

M131034.1210πundefined

(6)

Compute the covariance for this Matrix data sample. The entry at ith row and the jth column of the resulting Matrix stands for the covariance of the two data samples stored in the ith and jth columns of the input Matrix. Notice that Floatundefined in the returned Matrix means the same as undefined but is generated from operations on the floating-point value in the original Matrix.

CovarianceM

673−0.539086257093885undefined−0.5390862570938850.358098853533942FloatundefinedundefinedFloatundefinedundefined

(7)

Consider random variables with parameters a, b, c, d.

XNormalRandomVariablea,b:

YNormalRandomVariablec,d:

CovarianceX+Y,XY

a2+b2c2d2a+cac

(8)

Use the inert option.

JPoissonRandomVariableπ:

KPoissonRandomVariable1:

CovarianceJK,K2,inert

_t0=0_t=0_t_t03π_tⅇπ_t!ⅇ−1_t0!_t2=0_t1=0_t1_t2π_t1ⅇπ_t1!ⅇ−1_t2!_t3=0_t32ⅇ−1_t3!

(9)

evalfCovarianceJK,K2,inert

9.424777962

(10)

CovarianceJK,K2,numeric

9.424777970

(11)

References

  

Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.

Compatibility

• 

The Student[Statistics][Covariance] command was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

Statistics[Covariance]

Student

Student[Statistics]

Student[Statistics][RandomVariable]