Learn R Programming

truncdist (version 1.0-2)

rtrunc: Generate truncated random deviates

Description

This function generates n random deviates that are drawn from the specified truncated distribution.

Usage

rtrunc(n, spec, a = -Inf, b = Inf, ...)

Arguments

n
a positive integer for the number of random deviates generated
spec
a character value that specifies the underlying probability distribution
a
a numeric value for the lower bound of the random variable
b
a numeric value for the upper bound of the random variable
...
other arguments are are passed to the corresponding quantile function

Value

A vector with one or more random deviates.

References

Nadarajah, S. and S. Kotz, 2006. R Programs for Computing Truncated Distributions, Journal of Statistical Software, 16, August 2006, http://www.jstatsoft.org/v16/c02

See Also

qtrunc

Examples

Run this code
x <- rtrunc( 500, spec="norm", a=1, b=2 )

Run the code above in your browser using DataLab