efficient state-of-the-art generator of a vector of length(l)=length(u)
from the standard multivariate normal distribution,
truncated over the region [l,u];
infinite values for u and l are accepted;
Usage
trandn(l,u)
Arguments
l
lower truncation limit
u
upper truncation limit
Details
If you wish to simulate a random variable
Z drawn from N(μ,σ^2)
conditional on l<Z<u, then first simulate
X=trandn((l-mu)/sig,(u-mu)/sig) and set Z=mu+sig*X;
Value
random variable(s) drawn from the truncated normal distribution
Note
Use norminvp for the (slower) inverse transform method of simulating truncated normal variables.