| dhalfnormal | R Documentation |
Half-normal, half-Student-t and half-Cauchy density, distribution, quantile functions, random number generation, and expectation and variance.
dhalfnormal(x, scale=1, log=FALSE)
phalfnormal(q, scale=1)
qhalfnormal(p, scale=1)
rhalfnormal(n, scale=1)
ehalfnormal(scale=1)
vhalfnormal(scale=1)
dhalft(x, df, scale=1, log=FALSE)
phalft(q, df, scale=1)
qhalft(p, df, scale=1)
rhalft(n, df, scale=1)
ehalft(df, scale=1)
vhalft(df, scale=1)
dhalfcauchy(x, scale=1, log=FALSE)
phalfcauchy(q, scale=1)
qhalfcauchy(p, scale=1)
rhalfcauchy(n, scale=1)
ehalfcauchy(scale=1)
vhalfcauchy(scale=1)
x, q |
quantile. |
p |
probability. |
n |
number of observations. |
scale |
scale parameter ( |
df |
degrees-of-freedom parameter ( |
log |
logical; if |
The half-normal distribution is simply a zero-mean normal distribution
that is restricted to take only positive values. The scale
parameter \sigma here corresponds to the underlying normal
distribution's standard deviation:
if X\sim\mathrm{Normal}(0,\sigma^2), then
|X|\sim\mathrm{halfNormal}(\mathrm{scale}\!=\!\sigma).
Its mean is \sigma
\sqrt{2/\pi}, and its variance is \sigma^2
(1-2/\pi).
Analogously, the half-t distribution is a truncated Student-t
distribution with df degrees-of-freedom,
and the half-Cauchy distribution is again a special case of the
half-t distribution with df=1 degrees of freedom.
Note that (half-) Student-t and Cauchy distributions arise as continuous mixture distributions of (half-) normal distributions. If
Y|\sigma\;\sim\;\mathrm{Normal}(0,\sigma^2)
where the standard deviation is
\sigma = \sqrt{k/X} and X is drawn from a
\chi^2-distribution with k degrees of freedom, then the
marginal distribution of Y is Student-t with k degrees of freedom.
‘dhalfnormal()’ gives the density function,
‘phalfnormal()’ gives the cumulative distribution
function (CDF),
‘qhalfnormal()’ gives the quantile function (inverse CDF),
and ‘rhalfnormal()’ generates random deviates.
The ‘ehalfnormal()’ and ‘vhalfnormal()’
functions return the corresponding half-normal distribution's
expectation and variance, respectively.
For the
‘dhalft()’, ‘dhalfcauchy()’ and related
function it works analogously.
Christian Roever christian.roever@med.uni-goettingen.de
C. Roever, R. Bender, S. Dias, C.H. Schmid, H. Schmidli, S. Sturtz, S. Weber, T. Friede. On weakly informative prior distributions for the heterogeneity parameter in Bayesian random-effects meta-analysis. Research Synthesis Methods, 12(4):448-474, 2021. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/jrsm.1475")}.
A. Gelman. Prior distributions for variance parameters in hierarchical models. Bayesian Analysis, 1(3):515-534, 2006. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/06-BA117A")}.
F. C. Leone, L. S. Nelson, R. B. Nottingham. The folded normal distribution. Technometrics, 3(4):543-550, 1961. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/1266560")}.
N. G. Polson, J. G. Scott. On the half-Cauchy prior for a global scale parameter. Bayesian Analysis, 7(4):887-902, 2012. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/12-BA730")}.
S. Psarakis, J. Panaretos. The folded t distribution. Communications in Statistics - Theory and Methods, 19(7):2717-2734, 1990. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03610929008830342")}.
dnorm, dt, dcauchy,
dlomax, drayleigh,
TurnerEtAlPrior, RhodesEtAlPrior,
bayesmeta.
#######################
# illustrate densities:
x <- seq(0,6,le=200)
plot(x, dhalfnormal(x), type="l", col="red", ylim=c(0,1),
xlab=expression(tau), ylab=expression("probability density "*f(tau)))
lines(x, dhalft(x, df=3), col="green")
lines(x, dhalfcauchy(x), col="blue")
lines(x, dexp(x), col="cyan")
abline(h=0, v=0, col="grey")
# show log-densities (note the differing tail behaviour):
plot(x, dhalfnormal(x), type="l", col="red", ylim=c(0.001,1), log="y",
xlab=expression(tau), ylab=expression("probability density "*f(tau)))
lines(x, dhalft(x, df=3), col="green")
lines(x, dhalfcauchy(x), col="blue")
lines(x, dexp(x), col="cyan")
abline(v=0, col="grey")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.