rtrun {bayesm} | R Documentation |
rtrun
draws from a truncated univariate normal distribution
rtrun(mu, sigma, a, b)
mu |
mean |
sigma |
sd |
a |
lower bound |
b |
upper bound |
Note that due to the vectorization of the rnorm,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.
draw (possibly a vector)
This routine is a utility routine that does not check the input arguments for proper dimensions and type.
Peter Rossi, Graduate School of Business, University of Chicago, Peter.Rossi@ChicagoGsb.edu.
For further discussion, see Bayesian Statistics and Marketing
by Allenby, McCulloch, and Rossi, Chapter 2.
http://gsbwww.uchicago.edu/fac/peter.rossi/research/bsm.html
## set.seed(66) rtrun(mu=c(rep(0,10)),sigma=c(rep(1,10)),a=c(rep(0,10)),b=c(rep(2,10)))