[R] plotting the lognormal density curve

Henrik Bengtsson hb at maths.lth.se
Wed Apr 9 09:39:32 CEST 2003


For the normal distribution

N <- 1000
xSamples <- rnorm(N, mean=0, sd=1)
hist(xSamples, freq=FALSE)
curve(dnorm(x, mean=0, sd=1), add=TRUE)

Similar for log normal; dlnorm() & friends.

Cheers

Henrik Bengtsson

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Garrett Gman
> Sent: den 9 april 2003 09:25
> To: r-help at stat.math.ethz.ch
> Subject: [R] plotting the lognormal density curve
> 
> 
> I am trying to plot a lognormal density curve on top of an 
> existing histogram. Can anybody suggest a simple way to do 
> this? Even if someone could just explain how to plot a 
> regular normal density curve on top of an existing histogram, 
> it would be a big help.
> 
> Also, is there some way to search through the R-help archives 
> other than simple browsing?
> 
> Thank you so much. Your help and time is greatly appreciated.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 
>



More information about the R-help mailing list