dist.Halft: Half-t Distribution

Description Usage Arguments Details Value References See Also Examples

Description

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

Usage

1
2
3
4
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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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"))

LaplacesDemon documentation built on May 29, 2017, 11:54 p.m.

Search within the LaplacesDemon package
Search all R packages, documentation and source code