0

If I'm given a joint distribution of 2 random variables say A and B, how would I find the covariance of A,B? (I have known to calculate E_X, E_Y, E_XY and apply formula, what I want to find library that calculate directly Cov(X,Y) without E_X,E_Y..).
Joint distribution:

X|Y 1 3 5
1  0.1 0.2 0.3
4  0.2 0.05 0.15
NamNguyen
  • 21
  • 6
  • There might be a library which implements a covariance function for discrete variables. However, it seems likely that it would be simpler to just compute covariance directly from the definition -- it is a summation over all the possible values of X and Y, and there are only 6 of those. – Robert Dodier May 13 '23 at 16:53

1 Answers1

0

Do you mean sth like: np.cov()?

check:

import numpy as np