[R] How to plot Histogram with frequence overlaid by distribution curve

Rolf Turner rolf at math.unb.ca
Thu Mar 4 12:55:22 CET 2004


You wrote:

> I am having a new problem that how I can set the probability scale
> from 0 to 1 when I using on probability scale. Sometimes I get the
> maximum probabilty more than 100%.

When you set prob=TRUE you get a ***density*** scale.  The resulting
histogram represents a probability density function (directly comparable
with the normal density function you sought to superimpose) which
***integrates*** to 1.  The values of a density funcion need not
be less than 1; these values are not probabilities.  They are probability
densities.  Roughly if f(x) is the p.d.f. for X then

		f(x) dx approx. = P(x <= X <= x + dx)

I.e. f(x) dx will be less than 1, but f(x) on its own need not be.

O.K.?

					cheers,

						Rolf Turner
						rolf at math.unb.ca




More information about the R-help mailing list