0

I have a data set which follows lognormal distribution (parameters $μ$, $σ$ known - estimated by maximum likelihood estimation). I have to generate random numbers within range $[a:b]$ from this known distribution (a and b are predetermined and hence known as well). I am confused how should this be done. I am thinking of proceeding in following way - use runif with min and max ranges and qlnorm from the known lognormal distribution, e.g.

min = plnorm(a, meanlog = μ, sdlog = σ)
max = plnorm(b, meanlog = μ, sdlog = σ)
qlnorm(runif(x, min = min, max = max), meanlog = μ, sdlog = σ)

Will this approach be correct?

Also, just out of curiosity, can I fit a log-normal only to this interval (i.e. in $[a:b]$ ) and generate random numbers using the same approach as above? Is my understanding correct that this will be essentially a truncated distribution? Also, what will be the new values of "a" & "b" used above to generate min and max quantiles using plnorm of this new truncated distribution?

user101874
  • 25
  • 3
  • Although you begin by describing a pure simulation problem, you mention data and fitting distributions along the way. Something's missing. How are the data supposed to be related to the simulation? Please note that your originally stated problem requires four parameters: two to describe the underlying lognormal distribution (usually the mean and SD of the Normal distribution on which the Lognormal is based) along with the endpoints of the interval, $a$ and $b.$ You can't deduce any one of these four parameters from the other three. – whuber May 27 '22 at 21:57
  • The underlying data is supposed to follow a log normal distribution. The interval is known. Basically, the idea is to fit a distribution (either truncated or on full data), and use it to generate additional data points within the known interval [a:b]. – user101874 May 27 '22 at 22:04
  • 1
    I would phrase the question as: We are given samples from a lognormal distribution $LN(\mu,\sigma)$ truncated to the range $[a,b]$, where $a,b$ are known but $\mu,\sigma$ are not. How can we estimate $\mu,\sigma$ and how can we reliably generate further samples in this range from an appropriate lognormal? – Matt F. May 28 '22 at 02:37
  • I realised from comments that question had poor wording, making it hard to understand. I have edited the question now (wordings heavily, but essence of my question remains the same). Hopefully it's easier to understand now! Thanks. – user101874 May 29 '22 at 00:50
  • Perhaps my answer to a closely related question at https://stats.stackexchange.com/a/508780/919 addresses all these issues? – whuber May 31 '22 at 13:05

0 Answers0