Correlation - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Student[Statistics]

  

Correlation

  

compute the correlation

 

Calling Sequence

Parameters

Description

Computation

Examples

References

Compatibility

Calling Sequence

Correlation(X, Y, numeric_option, inert_option)

Correlation(A, B, numeric_option)

Correlation(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 Correlation function computes the correlation of two data samples or the correlation 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

• 

By default, all computations involving random variables are performed symbolically (see option numeric below).

• 

If there are floating point values or the option numeric is included, then the computation is done in floating point. Otherwise the computation is exact.

• 

By default, the correlation is computed according to the rules mentioned above. To always compute the correlation numerically, specify the numeric or numeric = true option.

Examples

> 

with⁡StudentStatistics:

> 

U≔seq⁡57..77

U≔57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77

(1)
> 

V≔seq⁡sin⁡i,i=57..77

V≔sin⁡57,sin⁡58,sin⁡59,sin⁡60,sin⁡61,sin⁡62,sin⁡63,sin⁡64,sin⁡65,sin⁡66,sin⁡67,sin⁡68,sin⁡69,sin⁡70,sin⁡71,sin⁡72,sin⁡73,sin⁡74,sin⁡75,sin⁡76,sin⁡77

(2)
> 

Correlation⁡U,undefined,V,2

undefined

(3)
> 

Correlation⁡Vectorrow⁡1,2,Vectorcolumn⁡π,2

1−π2⁢2π2−12+1−π22

(4)

If the computation contains floating point values or the numeric option is included, then a floating point value will be returned.

> 

Correlation⁡Vectorrow⁡1,2.0,Vectorcolumn⁡π,2

−0.999999999566904

(5)
> 

Correlation⁡Vectorrow⁡1,2,Vectorcolumn⁡π,2,numeric

−1.00000000000000

(6)

Compute the correlation between two random variables.

> 

A≔NormalRandomVariable⁡a,b:

> 

B≔NormalRandomVariable⁡c,d:

> 

Correlation⁡A+B,B

c⁢a+c2+d2−a+c⁢cb2+d2⁢d

(7)
> 

P≔NormalRandomVariable⁡2,3:

> 

Q≔NormalRandomVariable⁡1,4:

> 

Correlation⁡P+Q,Q

45

(8)

Use the inert option.

> 

X≔PoissonRandomVariable⁡3:

> 

Correlation⁡X,X,inert

∑_t=0∞⁡_t2⁢3_t⁢ⅇ−3_t!−∑_t0=0∞⁡_t0⁢3_t0⁢ⅇ−3_t0!⁢∑_t1=0∞⁡_t1⁢3_t1⁢ⅇ−3_t1!∑_t3=0∞⁡_t3−∑_t2=0∞⁡_t2⁢3_t2⁢ⅇ−3_t2!2⁢3_t3⁢ⅇ−3_t3!⁢∑_t5=0∞⁡_t5−∑_t4=0∞⁡_t4⁢3_t4⁢ⅇ−3_t4!2⁢3_t5⁢ⅇ−3_t5!

(9)
> 

Correlation⁡X,X,numeric

0.9999999999

(10)
> 

M≔Matrix⁡4,2,1,undefined,2.0,4,π,4,2

M≔421undefined2.04π42

(11)
> 

Correlation⁡M

undefinedFloat⁡undefinedundefinedFloat⁡undefined1.−0.188982236506435undefined−0.1889822365064351

(12)

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][Correlation] command was introduced in Maple 18.

• 

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

See Also

Statistics[Correlation]

Student

Student[Statistics]

Student[Statistics][RandomVariable]