Daniela Garavaglia wrote:
Sorry, I have some troubles with the graph device.

How can I draw a function over a histogram?

Thank's so much.
Daniela,
What function?
Here is one example using density() and using dnorm()
x <- rnorm(1000,2,2)
hist(x,prob=TRUE)
lines(density(x,na.rm=TRUE),col="red")
library(MASS)
y <- fitdistr(x,"normal")
curve(dnorm(x,mean=y$estimate[1],sd=y$estimate[2]),add=TRUE)

HTH
R.

        [[alternative HTML version deleted]] <--- What about this??



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to