Learn R Programming

extraDistr (version 1.10.0)

HalfT: Half-t distribution

Description

Density, distribution function, quantile function and random generation for the half-t distribution.

Usage

dht(x, nu, sigma = 1, log = FALSE)

pht(q, nu, sigma = 1, lower.tail = TRUE, log.p = FALSE)

qht(p, nu, sigma = 1, lower.tail = TRUE, log.p = FALSE)

rht(n, nu, sigma = 1)

Arguments

x, q

vector of quantiles.

nu, sigma

positive valued degrees of freedom and scale parameters.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are \(P[X \le x]\) otherwise, \(P[X > x]\).

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Details

If \(X\) follows t distribution parametrized by degrees of freedom \(\nu\) and scale \(\sigma\), then \(|X|\) follows half-t distribution parametrized by degrees of freedom \(\nu\) and scale \(\sigma\).

References

Gelman, A. (2006). Prior distributions for variance parameters in hierarchical models (comment on article by Browne and Draper). Bayesian analysis, 1(3), 515-534.

Jacob, E. and Jayakumar, K. (2012). On Half-Cauchy Distribution and Process. International Journal of Statistika and Mathematika, 3(2), 77-81.

See Also

HalfNormal, HalfCauchy

Examples

Run this code

x <- rht(1e5, 2, 2)
hist(x, 500, freq = FALSE, xlim = c(0, 100))
curve(dht(x, 2, 2), 0, 100, col = "red", add = TRUE)
hist(pht(x, 2, 2))
plot(ecdf(x), xlim = c(0, 100))
curve(pht(x, 2, 2), 0, 100, col = "red", lwd = 2, add = TRUE)

Run the code above in your browser using DataLab