rtuvn: Random number generation for truncated univariate normal...

Description Usage Arguments Value Examples

View source: R/rtuvn.R

Description

rtuvn simulates truncated univariate normal distribution within the interval.

Usage

1
rtuvn(n = 1, mean = 0, sd = 1, lower, upper)

Arguments

n

number of random samples desired (sample size).

mean

mean of the underlying univariate normal distribution.

sd

standard deviation of the underlying univariate normal distribution.

lower

lower bound for truncation.

upper

upper bound for truncation.

Value

rtuvn returns a vector of random number follows truncated univariate normal distribution.

Examples

1
2
3
4
5
6
set.seed(1203)
ans <- rtuvn(n=1000, mean=1, sd=2, lower=-2, upper=3)
summary(ans)

# Check if the sample matches with CDF by KS test
ks.test(ans,"ptuvn",1,2,-2,3)

tmvmixnorm documentation built on Sept. 19, 2020, 1:07 a.m.

Related to rtuvn in tmvmixnorm...