Description Usage Arguments Details Value See Also Examples
These functions provide the density, distribution function, quantile function, and random generation for the half-normal distribution.
1 2 3 4  | 
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 sigma, which must be positive.  | 
log,log.p | 
 Logical. If   | 
lower.tail | 
 Logical. If   | 
Application: Continuous Univariate
Density: p(theta) = 2*sigma/pi e^-(theta^2*sigma^2/pi), theta >= 0
Inventor: Derived from the normal or Gaussian
Notation 1: theta ~ HALF-N(sigma)
Notation 2: p(theta) = HN(theta | sigma)
Parameter 1: scale parameter sigma > 0
Mean: E(theta) = 1 / sigma
Variance: var(theta) = (pi-2)/(2*sigma^2)
Mode: mode(theta) = 0
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.
dhalfnorm gives the density,
phalfnorm gives the distribution function,
qhalfnorm gives the quantile function, and
rhalfnorm generates random deviates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  | library(LaplacesDemonCpp)
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"))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.