[R] finding mean and SD for a log-normal distribution

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed May 16 17:13:47 CEST 2012



On 16.05.2012 12:37, Andras Farkas wrote:
> Dear R Expert
>
> allow me to ask a quick qestion: I have a mean value of 6 and a SD of 3 describing my distribution. I would like to "convert" this distribution into a log normal distribution that would best describe it when resimulated using log normal distribution. Currently I am using another software to estimate the respective mean and SD on the log scale and the results are: 1.6667 and SD 0.47071. Then, to best reproduce my original distribution in R, I use the following commands:
>
> c<- rlnorm(5000,1.6667,0.47071)
> d<- exp(c)
> mean(c)
> sd(c)
>
> and the results for mean and SD are 5.92 and 2.94 (original 6 and 3), respectively, which I am reasonably happy with. I would like to grow independent of the another software I use, but am unable to figure out how to generate the values of 1.6667 and 0.47071 using R. could someone please help me with this question?

Just make use of a textbook:

meanlog <- log(6) - 0.5 * log(1 + 9/(6^2))
sdlog <- sqrt(log(1 + 9/(6^2)))

Uwe Ligges




> thanks,
>
> Andras
> 	[[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list