Get parameters for normal distributions in Kernel fit of probability distribution

Illustration
Darin - 2022-06-09T12:09:41+00:00
Question: Get parameters for normal distributions in Kernel fit of probability distribution

Using Kernel to fit a series of normal distributions, how can you read out the means and sigmas of the normals it comes up with?   Also, is there a way to set the number of peaks it uses?

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

I understand that you would like to get information on the normal distributions that make up the Kernal distribution. I assume that the Kernal distribution is calculated using the fitdist function.
 
If you check out the "Kernal Smoothing Function" example on the Kernal distribution documentation page, you can see that they actually plot the normal distributions that make up that particular Kernal distribution.
 
The mean of each normal distribution will be one of the data points, and the sigma of each normal distribution will be the 'BandWidth' of the Kernal distribution. Each normal distribution has the same standard deviation.
 
For example, if you wanted to modify that example, you could allow the default 'BandWidth' to be chosen, and add together the calculated normal distributions to show that they are the same as the plotted Kernal distribution:
 
% Plot the Kernal distribution
SixMPG = [13;15;23;29;32;34];
figure;
pdSix = fitdist(SixMPG,'Kernel');
x = 0:.1:45;
ySix = pdf(pdSix,x);
plot(x,ySix,'k-','LineWidth',2);

% Plot each individual normal distribution and scale its appearance on the plot
hold on;
yNormSum = zeros(size(ySix));
for i=1:6
    pd = makedist('Normal','mu',SixMPG(i),'sigma',pdSix.BandWidth);
    y = pdf(pd,x);
    y = y/6;
    plot(x,y,'b:');
    yNormSum = yNormSum+y;
end
plot(x,yNormSum,'g--','LineWidth',1.5)
hold off

kernel-fit-of-probabilityqa

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!