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]);
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]);