# NOT RUN {
# n = 1000 truncated normal vector between [-2,3]
vec <- rtruncate(1000, rnorm, c(-2,3))
summary(vec)
# truncated correlated multivariate normal between [-1,4]
mat <- rtruncate(1000, rmvnorm, c(-1,4),
sigma = matrix(c(2,1,1,1),2))
summary(mat)
# truncated correlated multivariate normal between [-1,4] for the
# first column and [0,3] for the second column
mat <- rtruncate(1000, rmvnorm, cbind(c(-1,4), c(0,3)),
sigma = matrix(c(2,1,1,1),2))
summary(mat)
# truncated chi-square with df = 4 between [2,6]
vec <- rtruncate(1000, rchisq, c(2,6), df = 4)
summary(vec)
# }
Run the code above in your browser using DataLab