covariance inputs

Hi 'm trying to get the covariance between 2 columns of one matrix, but i dont know how

i tried something like:

vg = vcx(y[.,1], y[.,2]);

it didn't work

could you help me ?

1 Answer



0



The function vcx takes just one input. If you want the covariance between just two columns, you need to concatenation them together, or pull out just those two columns by index. For example:

//Create 25x3 matrix
y = rndn(25, 3);

//Calculate covariance of 1st and 3rd columns
cv_y = vcx(x[., 1 3]);

//Calculate covariance of 1st and 2nd columns
cv_y = vcx(x[., 1:2]);

aptech

1,773

Your Answer

1 Answer

0

The function vcx takes just one input. If you want the covariance between just two columns, you need to concatenation them together, or pull out just those two columns by index. For example:

//Create 25x3 matrix
y = rndn(25, 3);

//Calculate covariance of 1st and 3rd columns
cv_y = vcx(x[., 1 3]);

//Calculate covariance of 1st and 2nd columns
cv_y = vcx(x[., 1:2]);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy