How to generate the convolution density and integrate it on [a,b] fastly and precisely?

9 ビュー (過去 30 日間)
Tmat
Tmat 2020 年 8 月 16 日
コメント済み: Tmat 2020 年 9 月 28 日
Hi, I have two random variables X following distribution F with density f, and Y following distribution G with density g
random variable Z=X+Y, and I want to calculate the probability that Z belongs to interval [a,b].
I guess this could be done by first get the density of Z as the convolution of f and g, and then do numerical integration to this convolution density over [a,b]. How to do this in a fast and precise way? Thanks!

採用された回答

Jeff Miller
Jeff Miller 2020 年 8 月 22 日
If your random variables X and Y are independent, Cupid might be helpful. It defines a general convolution RV for any continuous independent RVs. If your distributions are already defined in cupid, the code would look something like:
X = Exponential(1/10); % Illustration with example distributions
Y = Beta(5,2.3);
Z = Convolution(X,Y);
a = 2;
b = 4;
probInterval = Z.CDF(b) - Z.CDF(a);
If either/both of your distributions are not already in Cupid, it is pretty easy to add new distributions if you have the formula for either the PDF or the CDF.
Whether this will be fast and accurate enough for you, I cannot say.

その他の回答 (1 件)

Mahesh Taparia
Mahesh Taparia 2020 年 8 月 22 日
Hi
You can use 'conv' function to perform the convolution of the CDF and 'integral' function to perform integration. For more information, refer to the documentation of conv function and integral function.
Hope it will help!
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 8 月 22 日
You cannot use conv() to do the convolution of a distribution. conv() is only for discrete convolution.
You can use the formal definition of convolution as an integral, which might require the symbolic toolbox.
Alternatively you could potentially use the property that convolution of two functions is the inverse fourier of the multiplication of the fourier transform. This would not be fft, this would be fourier() from the symbolic toolbox.
You can also do something similar with laplace transform.
Tmat
Tmat 2020 年 9 月 28 日
Thanks! This is helpful!

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by