powered by
Normal distribution truncated to the interval [a,b]
dtruncnorm(x, a = -Inf, b = Inf, mean = 0, sd = 1, log = FALSE)rtruncnorm(n, a = -Inf, b = Inf, mean = 0, sd = 1)
rtruncnorm(n, a = -Inf, b = Inf, mean = 0, sd = 1)
vector of quantiles
lower bound
upper bound
vector of means
vector of standard deviations
if TRUE, probabilities are given as log(p)
number of samples
# NOT RUN { samples <- rtruncnorm(1e5, -.5, 3, 1, 1) hist(samples, 200, freq = FALSE) curve(dtruncnorm(x, -.5, 3, 1, 1), -2,4, col = 2, lwd = 2, add = TRUE, n = 301) # }
Run the code above in your browser using DataLab