dist.Halft: Half-t Distribution

dist.HalftR Documentation

Half-t Distribution

Description

These functions provide the density, distribution function, quantile function, and random generation for the half-t distribution.

Usage

dhalft(x, scale=25, nu=1, log=FALSE)
phalft(q, scale=25, nu=1)
qhalft(p, scale=25, nu=1)
rhalft(n, scale=25, nu=1)

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 \alpha, which must be positive.

nu

This is the scalar degrees of freedom parameter, which is usually represented as \nu.

log

Logical. If log=TRUE then the logarithm of the density is returned.

Details

  • Application: Continuous Univariate

  • Density: p(\theta) = (1 + \frac{1}{\nu} (\theta / \alpha)^2)^{-(\nu+1)/2}, \quad \theta \ge 0

  • Inventor: Derived from the Student t

  • Notation 1: \theta \sim \mathcal{HT}(\alpha, \nu)

  • Notation 2: p(\theta) = \mathcal{HT}(\theta | \alpha, \nu)

  • Parameter 1: scale parameter \alpha > 0

  • Parameter 2: degrees of freedom parameter \nu

  • Mean: E(\theta) = unknown

  • Variance: var(\theta) = unknown

  • Mode: mode(\theta) = 0

The half-t distribution is derived from the Student t distribution, and is useful as a weakly informative prior distribution for a scale parameter. It is more adaptable than the default recommended half-Cauchy, though it may also be more difficult to estimate due to its additional degrees of freedom parameter, \nu. When \nu=1, the density is proportional to a proper half-Cauchy distribution. When \nu=-1, the density becomes an improper, uniform prior distribution. For more information on propriety, see is.proper.

Wand et al. (2011) demonstrated that the half-t distribution may be represented as a scale mixture of inverse-gamma distributions. This representation is useful for conjugacy.

Value

dhalft gives the density, phalft gives the distribution function, qhalft gives the quantile function, and rhalft generates random deviates.

References

Wand, M.P., Ormerod, J.T., Padoan, S.A., and Fruhwirth, R. (2011). "Mean Field Variational Bayes for Elaborate Distributions". Bayesian Analysis, 6: p. 847–900.

See Also

dhalfcauchy, dst, dt, dunif, and is.proper.

Examples

library(LaplacesDemon)
x <- dhalft(1,25,1)
x <- phalft(1,25,1)
x <- qhalft(0.5,25,1)
x <- rhalft(10,25,1)

#Plot Probability Functions
x <- seq(from=0.1, to=20, by=0.1)
plot(x, dhalft(x,1,-1), ylim=c(0,1), type="l", main="Probability Function",
     ylab="density", col="red")
lines(x, dhalft(x,1,0.5), type="l", col="green")
lines(x, dhalft(x,1,500), type="l", col="blue")
legend(2, 0.9, expression(paste(alpha==1, ", ", nu==-1),
     paste(alpha==1, ", ", nu==0.5), paste(alpha==1, ", ", nu==500)),
     lty=c(1,1,1), col=c("red","green","blue"))

LaplacesDemonR/LaplacesDemon documentation built on April 1, 2024, 7:22 a.m.