For the following example code I am getting a 2x2 covariance matrix. How could I get a 3x3 covariance matrix instead?
a = [3,9,8,2]
b = [4,7,2,5]
c = [3,4,6,7]
cov_abc = np.cov(a,b,c)
print cov_abc
Try
x = np.vstack([a,b,c])
cov = np.cov(x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With