Skip to contents

Generates random observations from a lognormal distribution truncated to the interval \((lower, upper)\) using inverse transform sampling.

Usage

rlnormt(n, meanlog, sdlog, lower, upper)

Arguments

n

Integer. Number of observations to generate.

meanlog

Numeric. Mean of the underlying normal distribution.

sdlog

Numeric. Standard deviation of the underlying normal distribution.

lower

Numeric. Lower truncation bound.

upper

Numeric. Upper truncation bound.

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/

Author

Martin Haringa