Student[Statistics]
Covariance
compute the covariance/covariance matrix
Calling Sequence
Parameters
Description
Computation
Examples
References
Compatibility
Covariance(X, Y, numeric_option, inert_option)
Covariance(A, B, numeric_option)
Covariance(M, numeric_option)
X
-
algebraic; random variable
Y
A
data sample
B
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
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.
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.
with⁡StudentStatistics:
Compute the covariance of two data sets.
A≔1,4,5,2
B≔2,π,sqrt⁡2,4
B≔2,π,2,4
Covariance⁡A,B
−83+π3+2⁢23
If numeric is specified, then the result is a floating point.
Covariance⁡A,B,numeric
−0.676660073888006
Computations involving undefined values will eventually return an undefined result. Whenever data samples have at most one data point, the covariance is also undefined.
U≔seq⁡57..77,undefined
V≔seq⁡sin⁡i,i=57..77,undefined
Covariance⁡U,V
undefined
Consider the following Matrix.
M≔Matrix⁡1,3,10,3,4.1,2,10,π,undefined
M≔131034.1210πundefined
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 Float⁡undefined in the returned Matrix means the same as undefined but is generated from operations on the floating-point value in the original Matrix.
Covariance⁡M
673−0.539086257093885undefined−0.5390862570938850.358098853533942Float⁡undefinedundefinedFloat⁡undefinedundefined
Consider random variables with parameters a, b, c, d.
X≔NormalRandomVariable⁡a,b:
Y≔NormalRandomVariable⁡c,d:
Covariance⁡X+Y,X−Y
a2+b2−c2−d2−a+c⁢a−c
Use the inert option.
J≔PoissonRandomVariable⁡π:
K≔PoissonRandomVariable⁡1:
Covariance⁡J⁢K,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!
evalf⁡Covariance⁡J⁢K,K2,inert
9.424777962
Covariance⁡J⁢K,K2,numeric
9.424777970
Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.
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][RandomVariable]
Download Help Document