dist.HalfNormal {LaplacesDemon} | R Documentation |
Half-Normal Distribution
Description
These functions provide the density, distribution function, quantile function, and random generation for the half-normal distribution.
Usage
dhalfnorm(x, scale=sqrt(pi/2), log=FALSE)
phalfnorm(q, scale=sqrt(pi/2), lower.tail=TRUE, log.p=FALSE)
qhalfnorm(p, scale=sqrt(pi/2), lower.tail=TRUE, log.p=FALSE)
rhalfnorm(n, scale=sqrt(pi/2))
Arguments
x , q |
These are each a vector of quantiles. |
p |
This is a vector of probabilities. |
n |
This is the number of observations, which must be a positive integer that has length 1. |
scale |
This is the scale parameter |
log , log.p |
Logical. If |
lower.tail |
Logical. If |
Details
Application: Continuous Univariate
Density:
Inventor: Derived from the normal or Gaussian
Notation 1:
Notation 2:
Parameter 1: scale parameter
Mean:
Variance:
Mode:
The half-normal distribution is recommended as a weakly informative prior distribution for a scale parameter that may be useful as an alternative to the half-Cauchy, half-t, or vague gamma.
Value
dhalfnorm
gives the density,
phalfnorm
gives the distribution function,
qhalfnorm
gives the quantile function, and
rhalfnorm
generates random deviates.
See Also
Examples
library(LaplacesDemon)
x <- dhalfnorm(1)
x <- phalfnorm(1)
x <- qhalfnorm(0.5)
x <- rhalfnorm(10)
#Plot Probability Functions
x <- seq(from=0.1, to=20, by=0.1)
plot(x, dhalfnorm(x,0.1), ylim=c(0,1), type="l", main="Probability Function",
ylab="density", col="red")
lines(x, dhalfnorm(x,0.5), type="l", col="green")
lines(x, dhalfnorm(x,1), type="l", col="blue")
legend(2, 0.9, expression(sigma==0.1, sigma==0.5, sigma==1),
lty=c(1,1,1), col=c("red","green","blue"))