| truncnorm | R Documentation |
Density, distribution function, quantile function, and random generation for the truncated normal distribution.
dtruncnorm(x, mean = 0, sd = 1, min = -Inf, max = Inf, log = FALSE)
ptruncnorm(q, mean = 0, sd = 1, min = -Inf, max = Inf,
lower.tail = TRUE, log.p = FALSE)
qtruncnorm(p, mean = 0, sd = 1, min = -Inf, max = Inf,
lower.tail = TRUE, log.p = FALSE)
rtruncnorm(n, mean = 0, sd = 1, min = -Inf, max = Inf)
x, q |
vector of quantiles |
mean |
mean parameter, must be positive. |
sd |
standard deviation parameter, must be positive. |
min, max |
truncation bounds. |
log, log.p |
logical; if |
lower.tail |
logical; if |
p |
vector of probabilities |
n |
number of random values to return. |
This implementation of dtruncnorm allows for automatic differentiation with RTMB.
dtruncnorm gives the density, ptruncnorm gives the distribution function, qtruncnorm gives the quantile function, and rtruncnorm generates random deviates.
x <- rtruncnorm(1, mean = 2, sd = 2, min = -1, max = 5)
d <- dtruncnorm(x, mean = 2, sd = 2, min = -1, max = 5)
p <- ptruncnorm(x, mean = 2, sd = 2, min = -1, max = 5)
q <- qtruncnorm(p, mean = 2, sd = 2, min = -1, max = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.