truncnorm: Random simulator for the truncated normal distribution

View source: R/truncnorm.R

truncnormR Documentation

Random simulator for the truncated normal distribution

Description

This is a plain random generator for a normal variate \code{pnorm(x,mu,tau)} 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)

bayess documentation built on Aug. 11, 2022, 5:07 p.m.

Related to truncnorm in bayess...