How to get probability of new data point from prob

2019-09-09 11:09发布

问题:

I have fitted several probability distribution to my dataset by using the Matlab fitdist function in the following way:

pd = fitdist(myDataset,distname)

From this function I got a probability distribution object pd. I now that I can calculate mean(pd), std(pd), median(pd) etc.

But how can I calculate the probability of a new data point according to the fitted distribution?

回答1:

You can evaluate the probability value thanks to the pdf() function.
First of all you can create your probability distribution object thanks to the fitdist() function, as you already did actually.

pd = fitdist(myDataset,distname);

Now, to gather the probability value for a point myPoint you can use pdf() as follows:

myProb=pdf(pd,myPoint);

where pd is the output from fitdist() and myPoint can either be a single point or a vector of points. Consequently, myProb will be a single point or a vector or points (respectively) since each value in myProb corresponds to a value in myPoint.