# Td-class

##### Class "Td"

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$).
C.f. `rt`

- Keywords
- distribution

##### Note

The general *non-central* $t$
with parameters $(\nu,\delta)$ `= (df, ncp)`

is defined as a the distribution of
$T_{\nu}(\delta) := \frac{U + \delta}{\chi_{\nu}/\sqrt{\nu}}$
where $U$ and $\chi_{\nu}$ are independent random
variables, $U \sim {\cal N}(0,1)$, and $\chi^2_\nu$
is chi-squared, see `rchisq`

.
The most used applications are power calculations for $t$-tests:
Let $T= \frac{\bar{X} - \mu_0}{S/\sqrt{n}}$
where
$\bar{X}$ is the `mean`

and $S$ the sample standard
deviation (`sd`

) of $X_1,X_2,\dots,X_n$ which are i.i.d. $N(\mu,\sigma^2)$.
Then $T$ is distributed as non-centrally $t$ with
`df`

$= n-1$
degrees of freedom and **n**on-**c**entrality **p**arameter
`ncp`

$= (\mu - \mu_0) \sqrt{n}/\sigma$.

##### Objects from the Class

Objects can be created by calls of the form `Td(df)`

.
This object is a $t$ distribution.

##### Extends

Class `"AbscontDistribution"`

, directly.
Class `"UnivariateDistribution"`

, by class `"AbscontDistribution"`

.
Class `"Distribution"`

, by class `"AbscontDistribution"`

.

##### Ad hoc methods

For R Version `<2.3.0< code=""> ad hoc methods are provided for slots `

`q`

, `r`

if `ncp!=0`

;
for R Version `>=2.3.0`

the methods from package

##### concept

- absolutely continuous distribution
- T distribution
- S4 distribution class
- generating function

##### See Also

`TParameter-class`

,
`AbscontDistribution-class`

,
`Reals-class`

,
`rt`

##### Examples

```
T <- Td(df = 1) # T is a t distribution with df = 1.
r(T)(1) # one random number generated from this distribution, e.g. -0.09697573
d(T)(1) # Density of this distribution is 0.1591549 for x = 1.
p(T)(1) # Probability that x < 1 is 0.75.
q(T)(.1) # Probability that x < -3.077684 is 0.1.
df(T) # df of this distribution is 1.
df(T) <- 2 # df of this distribution is now 2.
Tn <- Td(df = 1, ncp = 5)
# T is a noncentral t distribution with df = 1 and ncp = 5.
d(Tn)(1) ## from R 2.3.0 on ncp no longer ignored...
```

*Documentation reproduced from package distr, version 2.0.2, License: LGPL-3*