DiscreteNormal | R Documentation |
Probability mass function, distribution function and random generation for discrete normal distribution.
ddnorm(x, mean = 0, sd = 1, log = FALSE)
pdnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
rdnorm(n, mean = 0, sd = 1)
x , q |
vector of quantiles. |
mean |
vector of means. |
sd |
vector of standard deviations. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are |
n |
number of observations. If |
Probability mass function
f(x) = \Phi\left(\frac{x-\mu+1}{\sigma}\right) - \Phi\left(\frac{x-\mu}{\sigma}\right)
Cumulative distribution function
F(x) = \Phi\left(\frac{\lfloor x \rfloor + 1 - \mu}{\sigma}\right)
Roy, D. (2003). The discrete normal distribution. Communications in Statistics-Theory and Methods, 32, 1871-1883.
Normal
x <- rdnorm(1e5, 0, 3)
xx <- -15:15
plot(prop.table(table(x)))
lines(xx, ddnorm(xx, 0, 3), col = "red")
hist(pdnorm(x, 0, 3))
plot(ecdf(x))
xx <- seq(-15, 15, 0.1)
lines(xx, pdnorm(xx, 0, 3), col = "red", lwd = 2, type = "s")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.