
Generate random samples from a truncated lognormal distribution
Source:R/truncated_distributions.R
rlnormt.RdGenerates random observations from a lognormal distribution truncated to the interval \((lower, upper)\) using inverse transform sampling.
Value
A numeric vector of length n containing random draws from the
truncated lognormal distribution.
Details
Random values are generated by sampling from a uniform distribution on the interval \([F(lower), F(upper)]\), where \(F\) is the CDF of the lognormal distribution, and then applying the inverse CDF.
This approach ensures that the generated values follow the truncated distribution exactly.
The implementation is based on the inverse transform method as described in: https://www.r-bloggers.com/2020/08/generating-data-from-a-truncated-distribution/