Vermin
Vermin

Reputation: 13

CDF of the sum of two random variables not giving the expected result

I'm trying to numerically calculate the CDF of the sum of two random variables and I'm having trouble replicating answers on StackOverflow.

This question CDF of a sum of independent random variables and this question Cumulative Distribution Function of 𝑋+𝑌 , where 𝑋,𝑌 are independent is convolution of 𝐹𝑋 and 𝐹𝑌 ? suggest this relationship is:

𝐹𝑋+𝑌(𝑎)=(𝐹𝑋∗𝑔)(a)

I've numerically calculated a CDF and a PDF for two independent random variables. Here's the PDF and the CDF:

PDF and CDF

but when I convolve them using:

np.convolve(a=pdf,
            v=cdf)

I get something that plainly isn't a CDF:

Not a CDF

On thinking about this, I can't see how the convolution of a CDF and PDF can give a CDF, surely the convolution will end up with something that breaks the rules for CDFs (non-decreasing, goes to 1 etc.). I can't see how digitizing the continuous functions is responsible for my problems either.

Can anyone state how I might get the CDF for X + Y from the PDF and CDF of X and Y if I have the digitized data? Are there numerical (digitization) issues I'm missing?

Upvotes: 0

Views: 65

Answers (1)

EuanG
EuanG

Reputation: 970

What is going wrong? You convolved the PDF of one variable with the CDF of the other.

np.convolve(a=pdf, v=cdf)

Problem: Convolving a PDF with a CDF does not yield a valid PDF or CDF. The convolution operation for summing random variables specifically requires convolving the PDFs of the variables.

Incorrect Formula:

𝐹𝑋+𝑌(𝑎)=(𝐹𝑋∗𝑔)(a)

How to Correct It:

Convolve the PDFs of X and Y to get the PDF of Z= X +Y and then Integrate the resulting PDF to obtain the CDF of Z.

Upvotes: 1

Related Questions