Learn R Programming

Runuran (version 0.21.0)

udt: UNU.RAN object for Student t distribution

Description

Create UNU.RAN object for a Student t distribution with with df degrees of freedom. [Distribution] -- t (Student).

Usage

udt(df, lb=-Inf, ub=Inf)

Arguments

df
degrees of freedom (strictly positive). Non-integer values allowed.
lb
lower bound of (truncated) distribution.
ub
upper bound of (truncated) distribution.

Value

  • An object of class "unuran.cont".

Details

The $t$ distribution with df $= \nu$ degrees of freedom has density $$f(x) = \frac{\Gamma ((\nu+1)/2)}{\sqrt{\pi \nu} \Gamma (\nu/2)} (1 + x^2/\nu)^{-(\nu+1)/2}$$ for all real $x$. It has mean $0$ (for $\nu > 1$) and variance $\frac{\nu}{\nu-2}$ (for $\nu > 2$).

The domain of the distribution can be truncated to the interval (lb,ub).

References

N.L. Johnson, S. Kotz, and N. Balakrishnan (1995): Continuous Univariate Distributions, Volume 2. 2nd edition, John Wiley & Sons, Inc., New York. Chap. 28, p. 362.

See Also

unuran.cont.

Examples

Run this code
## Create distribution object for t distribution
distr <- udt(df=4)
## Generate generator object; use method PINV (inversion)
gen <- pinvd.new(distr)
## Draw a sample of size 100
x <- ur(gen,100)

Run the code above in your browser using DataLab