rtlnorm: Simulate from a Truncated Log-Normal Distribution

View source: R/iclogcondist_simulation_dist.R

rtlnormR Documentation

Simulate from a Truncated Log-Normal Distribution

Description

This function generates random samples from a truncated log-normal distribution using an acceptance-rejection method.

Usage

rtlnorm(n, meanlog = 0, sdlog = 1, upper_bound = Inf)

Arguments

n

An integer specifying the number of random samples to generate.

meanlog

A numeric value representing the mean of the log-normal distribution on the log scale. Default is 0.

sdlog

A positive numeric value representing the standard deviation of the log-normal distribution on the log scale. Default is 1.

upper_bound

A positive numeric value indicating the upper truncation point. Default is Inf (no truncation).

Value

A numeric vector of n random samples from the truncated log-normal distribution.

Examples

# Generate 10 random samples from a truncated log-normal distribution
rtlnorm(10, meanlog = 0, sdlog = 1, upper_bound = 5)


iclogcondist documentation built on April 4, 2025, 5:18 a.m.