0

I would like to get n randomly generated numbers from a lognormal distribution with a given mean and sd, but I want the generated values to be between e^10 and e^13.

I tried using EnvStats::rlnormTrunc(100000, meanlog=11.532, sdlog=3.484, min=20000, max=450000) but the sd of the data generated is not what I want. What can I do??

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73
Stuti
  • 1
  • 1
  • 4
    Do you want the sdlog to be 3.484 *after* truncation? Helpful to note that `rlnormTrunc` is in the `EnvStats` package (and the help says that `sdlog` is the SD *before* truncation). See e.g. https://stackoverflow.com/questions/45389565/generate-data-from-truncated-normal-distribution-with-exact-mean-and-sd-in-r – Ben Bolker Jun 22 '23 at 20:39
  • 1
    What **do** you get for the moments of your code, and can you clarify specifically what values (for mean and sd) you expect (and why) for your truncated dataset? There are some good sampling methods that may work out better but first we (and you) need to understand exactly what you really want. – Carl Witthoft Jun 22 '23 at 23:51

0 Answers0