
Generate random samples from a truncated gamma distribution
Source:R/truncated_distributions.R
rgammat.RdGenerates random observations from a gamma distribution truncated to the interval \((lower, upper)\) using inverse transform sampling.
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 gamma 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/