Convolution of two probability density function

15 visualizzazioni (ultimi 30 giorni)
Poulomi Ganguli
Poulomi Ganguli il 23 Set 2019
Risposto: Jeff Miller il 24 Set 2019
Hello:
I am interested to add two independent random variables, X1 and X2, described by kernel density functions. Is there any way to find out the joint PDF using convolution process in MATLAB?

Risposte (1)

Jeff Miller
Jeff Miller il 24 Set 2019
I don't know whether you can do this directly in MATLAB. If not, you can do it using the Cupid toolbox. Here is an example:
% Generate some data to use for an example:
data1 = randn(200,1);
data2 = 20*rand(300,1);
% Make the corresponding MATLAB kernel distribution objects:
kern1 = fitdist(data1,'Kernel');
kern2 = fitdist(data2,'Kernel');
% Derive Cupid distribution objects from MATLAB ones:
ckern1 = dMATLABc(kern1);
ckern2 = dMATLABc(kern2);
% Make a Convolution distribution from the Cupid distribution objects:
convkern = Convolution(ckern1,ckern2);
% Compute various properties of the convolution distribution:
a = convkern.Median
b = convkern.Mean
c = convkern.Variance
d = convkern.PDF(12)
e = convkern.CDF(13)
convkern.PlotDens; % Plot PDF and CDF
% et cetera

Community Treasure Hunt

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

Start Hunting!

Translated by