Td-class {distr}R Documentation

Class "Td"

Description

The tt distribution with df =ν= \nu degrees of freedom has density

f(x)=Γ((ν+1)/2)πνΓ(ν/2)(1+x2/ν)(ν+1)/2 f(x) = \frac{\Gamma ((\nu+1)/2)}{\sqrt{\pi \nu} \Gamma (\nu/2)} (1 + x^2/\nu)^{-(\nu+1)/2}%

for all real xx. It has mean 00 (for ν>1\nu > 1) and variance νν2\frac{\nu}{\nu-2} (for ν>2\nu > 2). C.f. rt

Objects from the Class

Objects can be created by calls of the form Td(df). This object is a tt distribution.

Slots

img

Object of class "Reals": The domain of this distribution has got dimension 1 and the name "Real Space".

param

Object of class "TParameter": the parameter of this distribution (df), declared at its instantiation

r

Object of class "function": generates random numbers (calls function rt)

d

Object of class "function": density function (calls function dt)

p

Object of class "function": cumulative function (calls function pt)

q

Object of class "function": inverse of the cumulative function (calls function qt)

.withArith

logical: used internally to issue warnings as to interpretation of arithmetics

.withSim

logical: used internally to issue warnings as to accuracy

.logExact

logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function

.lowerExact

logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function

Symmetry

object of class "DistributionSymmetry"; used internally to avoid unnecessary calculations.

Extends

Class "AbscontDistribution", directly.
Class "UnivariateDistribution", by class "AbscontDistribution".
Class "Distribution", by class "AbscontDistribution".

Methods

initialize

signature(.Object = "Td"): initialize method

df

signature(object = "Td"): returns the slot df of the parameter of the distribution

df<-

signature(object = "Td"): modifies the slot df of the parameter of the distribution

ncp

signature(object = "Td"): returns the slot ncp of the parameter of the distribution

ncp<-

signature(object = "Td"): modifies the slot ncp of the parameter of the distribution

Ad hoc methods

For R Version <2.3.0 ad hoc methods are provided for slots q, r if ncp!=0; for R Version >=2.3.0 the methods from package stats are used.

Note

The general non-central tt with parameters (ν,δ)(\nu,\delta) = (df, ncp) is defined as a the distribution of Tν(δ):=U+δχν/νT_{\nu}(\delta) := \frac{U + \delta}{\chi_{\nu}/\sqrt{\nu}} where UU and χν\chi_{\nu} are independent random variables, UN(0,1)U \sim {\cal N}(0,1), and χν2\chi^2_\nu is chi-squared, see rchisq.

The most used applications are power calculations for tt-tests:
Let T=Xˉμ0S/nT= \frac{\bar{X} - \mu_0}{S/\sqrt{n}} where Xˉ\bar{X} is the mean and SS the sample standard deviation (sd) of X1,X2,,XnX_1,X_2,\dots,X_n which are i.i.d. N(μ,σ2) N(\mu,\sigma^2). Then TT is distributed as non-centrally tt with df=n1= n-1 degrees of freedom and non-centrality parameter ncp=(μμ0)n/σ= (\mu - \mu_0) \sqrt{n}/\sigma.

Author(s)

Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de

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.
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
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...

[Package distr version 2.9.3 Index]