| foldnorm | R Documentation |
Density, distribution function, and random generation for the folded normal distribution.
dfoldnorm(x, mu = 0, sigma = 1, log = FALSE)
pfoldnorm(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
rfoldnorm(n, mu = 0, sigma = 1)
x, q |
vector of quantiles |
mu |
location parameter |
sigma |
scale parameter, must be positive. |
log, log.p |
logical; if |
lower.tail |
logical; if |
n |
number of random values to return |
p |
vector of probabilities |
This implementation of dfoldnorm allows for automatic differentiation with RTMB.
f(x;\,\mu,\sigma) = \frac{1}{\sigma\sqrt{2\pi}}\left[\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) + \exp\!\left(-\frac{(x+\mu)^2}{2\sigma^2}\right)\right], \quad x \geq 0.
With \mu = 0 this is the half-normal distribution, the limiting case
of the half-t as its degrees of freedom grow.
dfoldnorm gives the density, pfoldnorm gives the distribution function, and rfoldnorm generates random deviates.
halft, halfcauchy
x <- rfoldnorm(1, 1, 2)
d <- dfoldnorm(x, 1, 2)
p <- pfoldnorm(x, 1, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.