lundi 15 mai 2023

Generate standardised log-normal data in R

I want to generate data from a log-normal distribution, with mean zero and variance equal to 1, in R.

I have tried this so far:

(rlnorm(n = 100000, mean = 0, sdlog = 1) - exp(1/2))/(exp(1)*(exp(1)-1))

Using the wikipedia page, to get the mean and variance on the standard scale. I think that I have centred correctly, as when I calculate the sample mean for this generated data I get a value close to zero. However, the sample variance is not close to 1.




Aucun commentaire:

Enregistrer un commentaire