I've prepared a vector by sampling a log-normal distribution by (by trial and error) setting the parameters for mean
and sd
so rlnorm()
returns exactly a mean of 20 and a sd of 6 (to 3 decimal places) for the any specified random set.seed()
as per the following example...
# 10,000 samples from log-normal distribution
set.seed(7)
HcT <- rlnorm(n = 10000, log(19.147), log(1.33832))
# Report mean and sd
paste('The mean of HcT is',round(mean(HcT),3),'and the SD is',round(sd(HcT),3))
[1] "The mean of HcT is 20 and the SD is 6"
However, rather than trial and error I would like to 'goal seek' the two parameters. There are several stack overflow examples for single value goal seek but I'm not sure what function or package to apply for a two parameter case (mean and SD in the above sample).