rtrun {bayesm}R Documentation

Draw from Truncated Univariate Normal

Description

rtrun draws from a truncated univariate normal distribution

Usage

rtrun(mu, sigma, a, b)

Arguments

mu mean
sigma sd
a lower bound
b upper bound

Details

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.

Value

draw (possibly a vector)

Warning

This routine is a utility routine that does not check the input arguments for proper dimensions and type.

Author(s)

Peter Rossi, Graduate School of Business, University of Chicago, Peter.Rossi@ChicagoGsb.edu.

References

For further discussion, see Bayesian Statistics and Marketing by Rossi, Allenby and McCulloch, Chapter 2.
http://faculty.chicagogsb.edu/peter.rossi/research/bsm.html

Examples

##
set.seed(66)
rtrun(mu=c(rep(0,10)),sigma=c(rep(1,10)),a=c(rep(0,10)),b=c(rep(2,10)))

[Package bayesm version 2.2-2 Index]