rtexp: Sample values from a left-truncated exponential distribution

rtexpR Documentation

Sample values from a left-truncated exponential distribution

Description

This function is a simple wrapper around the rexp function, allowing users to directly sample values from a left-truncated exponential distribution.

Usage

rtexp(n, rate, l=NULL)

Arguments

n

How many draws to make.

rate

A numeric vector of numbers > 0, specifying the rate parameter of the exponential distribution.

l

A numeric vector of numbers > 0, specifying the value at which the distribution should be left-truncated.

Details

This function mostly exists so it can be used conveniently when performing discrete-event simulations.

Value

Returns a numeric vector of length n.

Author(s)

Robin Denz

Examples

library(simDAG)

rtexp(n=10, rate=0.05, l=20)

# without replacement
dag <- empty_dag() +
  node("A", type="rtexp", rate=0.01, l=100)
data <- sim_from_dag(dag, n_sim=5)
head(data)

simDAG documentation built on Jan. 9, 2026, 1:08 a.m.