MATLAB Answers

0

How to derive probabilities from density function?

Asked by Clarisha Nijman on 9 Nov 2018
Latest activity Answered by Star Strider
on 9 Nov 2018
Hello,
I want to use the density function to find probabilities of unit intervals. In the distribution fitting app of Matlab, I draw two distributions I would like to compare. The Nakagami(blue) and the normal distribution (red).
Matlab documentation says that there is a pdf argument that should be added. I tried some combinations, now I have a code that does not give me any error, but the code is not good. It gives me the probabilities based on the counts. So the last line of my code does not work as it should. It should give me probabilities for the unit intervals: [<-5,-4>, [-4,-3>,...., [98,99>, [99,100>, [100,inf>. And that would differ for both distributions. How should I include a specific distribution in the arguments? Or should it be derived from the app? Does anyone have a suggestion for me?
Thank you in advance.
The code is:
Given:
U=[0:9];
lamda=0.42;
Y = poisspdf(U,lamda);%computes the Poisson pdf at each of the values in U using mean parameters in lambda.
W=[-5:100];
a=rand(10,1)+U'.^2;%A range of 10 values that I would like to analyse
pdfCounts=hist(a,W);%derive the pdf based on the histogram
pdfDensity=hist(a,W,'Normalization','pdf');%derive the pdf based on the densityplot

  0 Comments

Sign in to comment.

1 Answer

Answer by Star Strider
on 9 Nov 2018
 Accepted Answer

It would probably be best to use the fitdist (link) function. It will give you the parameters for the distribution that you can then use with the pdf (link) or related functions to calculate the probabilities.

  0 Comments

Sign in to comment.