Roman
Roman

Reputation: 131228

Is there a standard way to work with numerical probability density functions in Python?

I have a continuous random variable given by its density distribution function or by cumulative probability distribution function.

The distribution functions are not analytical. They are given numerically (for example as a list of (x,y) values).

One of the things that I would like to do with these distributions is to find a convolution of two of them (to have a distribution of a sum of two random properties).

I do not want to write my own function for that if there is already something standard and tested. Does anybody know if it is the case?

Upvotes: 3

Views: 376

Answers (1)

John Zwinck
John Zwinck

Reputation: 249542

How about numpy.convolve? It takes two arrays, rather than two functions, which seems ideal for your use. I'll also mention the ECDF function in the statsmodels package in case you really want to turn your observations into (step) functions.

Upvotes: 4

Related Questions