Description Usage Arguments Value Examples
Random number generation, probability density and cumulative density functions for truncated normal distribution.
1 2 3 4 5 |
x, q |
vector of quantiles; |
p1 |
mean (must be scalar). |
p2 |
standard deviation (must be scalar). |
lower |
lower truncation value (must be scalar). |
upper |
upper truncation value (must be scalar). |
lg |
log probability. If TRUE (default is FALSE) probabilities p are
given as |
n |
number of observations. n must be a scalar. |
lt |
lower tail. If TRUE (default) probabilities are |
a column vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## rtn example
dat1 <- rtnorm(1e5, 0, 1, 0, Inf)
hist(dat1, breaks = "fd", freq = FALSE, xlab = "",
main = "Truncated normal distributions")
## dtn example
x <- seq(-5, 5, length.out = 1e3)
dat1 <- dtnorm(x, 0, 1, -2, 2, 0)
plot(x, dat1, type = "l", lwd = 2, xlab = "", ylab= "Density",
main = "Truncated normal distributions")
## ptn example
x <- seq(-10, 10, length.out = 1e2)
mean <- 0
sd <- 1
lower <- 0
upper <- 5
dat1 <- ptnorm(x, 0, 1, 0, 5, lg = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.