[SciPy-User] Help understanding multivariate rv_discrete in the multivariate case

Giovanni Pugliese Carratelli gp459 at cam.ac.uk
Thu Oct 29 14:45:46 EDT 2020


Hello,

         I have just been trought the documentation for scipy's rv_discrete function. In particular I am interested in creating a discrete support multivariate rv from values I provide.

>From the documentation<https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete.html> it appers that it is possible only for a list of values.

So I have come up with the code:

a = [[1/6, 1/6, 1/6], [1/6, 1/6, 1/6]]
#print(np.shape(a))
xks=[[1,2,3],[1,2,3]];
joint = stats.rv_discrete(name='Joint', values=(xks, a));


Is this correct?

Moreover, how can I use "expect" now that the rv is multidimensional? I would need for instance to compute the expectation along only of the dimensions, or simply marginalise.


I have tried stackexchange to no avail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-user/attachments/20201029/c443f16c/attachment.html>


More information about the SciPy-User mailing list