<< nisp_corrcoef Support nisp_erfcinv >>

NISP >> NISP > Support > nisp_cov

nisp_cov

Returns the empirical covariance matrix of x and y.

Calling Sequence

C = nisp_cov ( x , y )

Parameters

x:

a n-by-1 matrix of doubles

y:

a n-by-1 matrix of doubles

C:

a 2-by-2 matrix of doubles, the empirical covariance

Description

Returns the empirical covariance matrix, normalized by n-1, where n is the number of observations. TODO : add the normalization by n TODO : add the C=cov(x) calling sequence

Examples

x = [1;2];
y = [3;4];
C = nisp_cov (x,y)
expected = [0.5,0.5;0.5,0.5]

x = [230;181;165;150;97;192;181;189;172;170];
y = [125;99;97;115;120;100;80;90;95;125];
expected = [1152.4556,-88.911111;-88.911111,244.26667]
C = nisp_cov (x,y)

Authors

Bibliography

"Introduction to probability and statistics for engineers and scientists.", Sheldon Ross

<< nisp_corrcoef Support nisp_erfcinv >>