These functions provide the density, distribution function, quantile function, and random generation for the half-t distribution.
1 2 3 4
These are each a vector of quantiles.
This is a vector of probabilities.
This is the number of observations, which must be a positive integer that has length 1.
This is the scale parameter alpha, which must be positive.
This is the scalar degrees of freedom parameter, which is usually represented as nu.
Application: Continuous Univariate
Density: p(theta) = (1 + (1/nu)*(theta/alpha)^2)^(-(nu+1)/2), theta >= 0
Inventor: Derived from the Student t
Notation 1: theta ~ HT(alpha,nu)
Notation 2: p(theta) = 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
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.
dhalft gives the density,
phalft gives the distribution function,
qhalft gives the quantile function, and
rhalft generates random deviates.
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.
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"))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.