Re: [R] Generating log transformed random numbers

2007-11-14 Thread David Scott
If you are after the lognormal distribution, I would recommend you use the lognormal functions from R itself. Check them out with ?dlnorm David Scott On Wed, 14 Nov 2007, Scionforbai wrote: > If what you want is a lognormal distribution of n values you can use > the following transformations

Re: [R] Generating log transformed random numbers

2007-11-14 Thread Scionforbai
If what you want is a lognormal distribution of n values you can use the following transformations: lognorm1 <- M*exp((rnorm(n)*sigma)-sigma^2/2.) which gives a lognormal distribution such that: mean(lognorm1)=M ; var(lognorm1)=M^2*(exp(sigma^2)-1); Changing the sigma (standard deviation) you alw

[R] Generating log transformed random numbers

2007-11-14 Thread Tobias Schlottmann
Dear R users, My question is that how it is possible to generate some random numbers using rnorm( ) function but in log transformed values. Thank you, Tobias - [[alternative HTML version deleted]]