rtrun draws from a truncated univariate normal distribution.
Usage
rtrun(mu, sigma, a, b)
Value
Draw (possibly a vector)
Arguments
mu
mean
sigma
standard deviation
a
lower bound
b
upper bound
Warning
This routine is a utility routine that does not check the input arguments for proper dimensions and type.
**Note also that rtrun is currently affected by the numerical accuracy of the inverse CDF function when trunctation points are far out in the tails of the distribution, where “far out” means \(|a - \mu| / \sigma > 6\) and/or \(|b - \mu| / \sigma > 6\). A fix will be implemented in a future version of bayesm.
Note that due to the vectorization of the rnorm and qnorm commands in R, all arguments can be vectors of equal length. This makes the inverse CDF method the most efficient to use in R.
References
For further discussion, see Chapter 2, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.