truncnorm {bayess}R Documentation

Random simulator for the truncated normal distribution

Description

This is a plain random generator for a normal variate \mathcal{N}(\mu,\tau^2) truncated to (a,b), using the inverse cdf qnorm. It may thus be imprecise for extreme values of the bounds.

Usage

truncnorm(n, mu, tau2, a, b)

Arguments

n

number of simulated variates

mu

mean of the original normal

tau2

variance of the original normal

a

lower bound

b

upper bound

Value

a sample of real numbers over (a,b) with size n

See Also

reconstruct

Examples

x=truncnorm(10^3,1,2,3,4)
hist(x,nclass=123,col="wheat",prob=TRUE)

[Package bayess version 1.6 Index]