rtn {mvrtn}R Documentation

random variates from truncated normal distribution

Description

Random variates from the left or right truncated normal distribution are generated. An efficient algorithm based on the inverse CDF method is used. This algorithm can be used to verify empirically the correcntess of the mean and variance computation done by the other function in this package, mvtn.

Usage

rtn(n, zmu = 0, zsig = 1, c = 1.96, side = c("left", "right"))

Arguments

n

number of random variables

zmu

mean parameter for normal distribution

zsig

standard deviation parameter

c

truncation point

side

either left or right

Details

The inverse cdf method is used in the case of the right truncated normal distribution. In the left truncated case, the negative of the corresponding right truncated distribution is used.

Value

the random variates, vector of length n

Author(s)

A. I. McLeod

References

For further details see the vignette.

See Also

mvtn

Examples

#Empirical validation
z<-rtn(10^4, 100, 15, c=120, side="left")
c(mean(z), var(z))
mvtn(100, 15, c=120, side="left")


[Package mvrtn version 1.0 Index]