How to find the probability (between 0 and 1) of an observation knowing that follow a Normal dist. and knowing its mean and variance?
11 views (last 30 days)
Show older comments
Hi All,
I know the mean and st. dev. of a Normal distribution and I would like to find the probability (between 0 and 1) of an observation.
I tried p = normpdf(x,mu,sigma)
where x is my observation value and mu and sigma the mean and st. dev. of the Gaussian.
I am getting extremely low values from different observations x.
I believe what I am doing is incorrect, how can I find the probability?
Thank you!
2 Comments
Image Analyst
on 6 Dec 2020
If the observation is a single number, wouldn't the probability be zero?
And if you want the probability of an observation being between one number and a different number, wouldn't you use the error function, erf()?
Answers (1)
John D'Errico
on 7 Dec 2020
Edited: John D'Errico
on 7 Dec 2020
You misunderstand what a PDF represents. This is a common mistake, suggesting you really want to do some reading about basic probability and statistics.
If you want to compute the probability of any exact event, such as the number 1 coming from a CONTINUOUS distribution, the probability is ZERO. You can compute the probability that a random variable will lie in some interval. But any exact value has measure zero.
As such, we can ask the probability that a standard normal random variable lies in the interval [0.9,1.1]...
diff(normcdf([0.9 1.1]))
So 0.0484. You get that from the CDF, not the PDF. If you wish, you could compute it as an integral of the PDF. Thus,
integral(@(x) normpdf(x),0.9,1.1)
And that is all the CDF gives you.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!