[R] Question about density()
Dan Bolser
dmb at mrc-dunn.cam.ac.uk
Fri Mar 4 02:48:34 CET 2005
If I integrate over the result of the density() funcion, is the result 1?
For example
x <- rnorm(1000)
plot(density(x))
Does the area under the curve I see sum to 1?
What I really want to know is if I can directly compare two particular
curves, generated like this
x <- rnorm(1000)
plot(density(x))
a.seq <- seq(min(x),max(x),0.01)
lines(a.seq,dnorm(x=a.seq,mean=mean(x),sd=sd(x)))
I guess they are directly comparable if the area under density sums to
one.
Is this correct?
More information about the R-help
mailing list