Reputation: 3937
Is this a good way of plotting a Normal Distribution? On occasion, I get a pdf value (pdf_x
) which is greater than 1.
% thresh_strain contains a Normally Distributed set of numbers
[mu_j,sigma_j] = normfit(thresh_strain);
x=linspace(mu_j-4*sigma_j,mu_j+4*sigma_j,200);
pdf_x = 1/sqrt(2*pi)/sigma_j*exp(-(x-mu_j).^2/(2*sigma_j^2));
plot(x,pdf_x);
Upvotes: 1
Views: 1037
Reputation: 2854
As @Daniel points out in his answer, with continuous random variables the PDF is a derivative of a probability (or a measure of intensity) so it can be greater than one. The CDF is a probability and must always be on [0, 1].
As an example, take the distributions marked below. The area under each curve is 1 (they are valid distributions) yet the density can be above 1.
Related StackExchange posts: here and here
Upvotes: 0
Reputation: 36720
The integral of a pdf is 1, at any point the values can be higher. Your plot is corect.
Upvotes: 2