How to generate the convolution density and integrate it on [a,b] fastly and precisely?
6 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
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
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
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!