powered by
rtuvn simulates truncated univariate normal distribution within the interval.
rtuvn
rtuvn(n = 1, mean = 0, sd = 1, lower, upper)
number of random samples desired (sample size).
mean of the underlying univariate normal distribution.
standard deviation of the underlying univariate normal distribution.
lower bound for truncation.
upper bound for truncation.
rtuvn returns a vector of random number follows truncated univariate normal distribution.
# NOT RUN { 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) # }
Run the code above in your browser using DataLab