Returns random samples from a truncated normal distribution.
Usage
rtnorm(N,mu,sigma,a,b)
Value
Returns 'N' random draws.
Arguments
N
Number of samples to return.
mu
A vector of length N that contains distribution means for
each draw.
sigma
A vector of length N that contains distribution standard
deviations for each draw.
a
Vector of length N of lower truncation points; may be -Inf.
b
Vector of length N of upper truncation point; may be Inf.
Author
Michael S. Pratte
Details
This function is currently unstable for drawing from regions
with extremely low probabilities. If this happens is should print
a warning, and return a draw from a uniform distribution between a
and b. See example below for how to break it.