rtrunc_gamma: Generate Random Variables from a Truncated Gamma...

View source: R/rtrunc_gamma.R

rtrunc_gammaR Documentation

Generate Random Variables from a Truncated Gamma Distribution.

Description

Simulates random variables from a truncated gamma distribution, where the gamma distribution is bounded between user-specified lower and upper limits. This function is typically used to define priors (e.g., for the separation time in delayed treatment effect models).

Usage

rtrunc_gamma(n, L, U, shape, scale)

Arguments

n

Integer. Number of random variables to generate.

L

Numeric. Lower bound of the truncation interval. Must satisfy L <= U.

U

Numeric. Upper bound of the truncation interval. Must satisfy U >= L.

shape

Numeric. Shape parameter of the underlying gamma distribution.

scale

Numeric. Scale parameter of the underlying gamma distribution.

Value

A numeric vector of length n, containing random variables drawn from a gamma distribution truncated to the interval [L, U].

Examples

rtrunc_gamma(10, 1, 1, 1, 1)

DTEBOP2 documentation built on June 8, 2025, 1:24 p.m.