TDist                 package:stats                 R Documentation

_T_h_e _S_t_u_d_e_n_t _t _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Density, distribution function, quantile function and random
     generation for the t distribution with 'df' degrees of freedom
     (and optional noncentrality parameter 'ncp').

_U_s_a_g_e:

     dt(x, df, ncp = 0, log = FALSE)
     pt(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
     qt(p, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
     rt(n, df, ncp = 0)

_A_r_g_u_m_e_n_t_s:

    x, q: vector of quantiles.

       p: vector of probabilities.

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

      df: degrees of freedom (> 0, maybe non-integer).  'df = Inf' is
          allowed.  For 'qt' only values of at least one are currently
          supported.

     ncp: non-centrality parameter delta; currently for 'pt()' and
          'dt()', only for 'ncp <= 37.62'.

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

lower.tail: logical; if TRUE (default), probabilities are P[X <= x],
          otherwise, P[X > x].

_D_e_t_a_i_l_s:

     The t distribution with 'df' = n degrees of freedom has density

 f(x) = Gamma((n+1)/2) / (sqrt(n pi) Gamma(n/2)) (1 + x^2/n)^-((n+1)/2)

     for all real x. It has mean 0 (for n > 1) and variance n/(n-2)
     (for n > 2).

     The general _non-central_ t with parameters (df,Del) '= (df, ncp)'
     is defined as the distribution of T(df, Del) := (U + Del) /
     (Chi(df) / sqrt(df))  where U and Chi(df)  are independent random
     variables, U ~ N(0,1), and Chi(df)^2 is chi-squared, see
     Chisquare.

     The most used applications are power calculations for t-tests:
      Let T= (mX - m0) / (S/sqrt(n)) where mX is the 'mean' and S the
     sample standard deviation ('sd') of X_1,X_2,...,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 - m0) * sqrt(n)/sigma.

_V_a_l_u_e:

     'dt' gives the density, 'pt' gives the distribution function, 'qt'
     gives the quantile function, and 'rt' generates random deviates.

     Invalid arguments will result in return value 'NaN', with a
     warning.

_S_o_u_r_c_e:

     The central 'dt' is computed via an accurate formula provided by
     Catherine Loader (see the reference in 'dbinom').

     For the non-central case of 'dt', contributed by Claus Ekstroem
     based on the relationship (for x != 0) to the cumulative
     distribution.

     For the central case of 'pt', a normal approximation in the tails,
     otherwise via 'pbeta'.

     For the non-central case of 'pt' based on a C translation of

     Lenth, R. V. (1989). _Algorithm AS 243_ - Cumulative distribution
     function of the non-central t distribution, _Applied Statistics_
     *38*, 185-189.

     For central 'qt', a C translation of

     Hill, G. W. (1970) Algorithm 396: Student's t-quantiles.
     _Communications of the ACM_, *13(10)*, 619-620.

     altered to take account of

     Hill, G. W. (1981) Remark on Algorithm 396, _ACM Transactions on
     Mathematical Software_, *7*, 250-1.

     The non-central case is done by inversion.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole. (Except non-central versions.)

     Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) _Continuous
     Univariate Distributions_, volume 2, chapters 28 and 31. Wiley,
     New York.

_S_e_e _A_l_s_o:

     'df' for the F distribution.

_E_x_a_m_p_l_e_s:

     1 - pt(1:5, df = 1)
     qt(.975, df = c(1:10,20,50,100,1000))

     tt <- seq(0,10, len=21)
     ncp <- seq(0,6, len=31)
     ptn <- outer(tt,ncp, function(t,d) pt(t, df = 3, ncp=d))
     image(tt,ncp,ptn, zlim=c(0,1),main=t.tit <- "Non-central t - Probabilities")
     persp(tt,ncp,ptn, zlim=0:1, r=2, phi=20, theta=200, main=t.tit,
           xlab = "t", ylab = "noncentrality parameter", zlab = "Pr(T <= t)")

     plot(function(x) dt(x, df = 3, ncp = 2), -3, 11, ylim = c(0, 0.32),
          main="Non-central t - Density", yaxs="i")

