Previous Page Next Page Contents

stats::Tdist -- the T-distribution

Introduction

stats::Tdist(x, v) computes the value

gamma((v+1)/2)/sqrt(PI*v)/gamma(v/2) * int(1/(1+u^2/v)^((v+1)/2), u=-infinity..x)

of the T-distribution with v degrees of freedom at the point x.

Call(s)

stats::Tdist(x, v)

Parameters

x - an arithmetical expression.
v - the ``degrees of freedom'': a positive real value.

Returns

If x is a real float and v is a constant real value, then a floating point value is returned. If x is not a real float and v is a positive integer, then an explicit arithmetical expression is returned. In all other cases an unevaluated call of stats::Tdist is returned.

Side Effects

The function is sensitive to the environment variable DIGITS, when the argument x is a floating point number.

Related Functions

gamma, stats::normal, stats::ChiSquare

Details

Example 1

We compute the T-distribution with two degrees of freedom at the point x=0.5:

>> stats::Tdist(0.5, 2)
   
                               0.6666666667
      

Exact values are produced, if the first argument is exact and the second argument is a positive integer:

>> stats::Tdist(7/8, 2)
   
                           /             1/2    1/2 \
                       1/2 |  1/2   7 128    177    |
                      2    | 2    + --------------- |
                           \             1416       /
                      -------------------------------
                                     4
      

Example 2

We compute the T-distribution with three degrees of freedom with a symbolic argument. An explicit expression is returned, when the second argument is a positive integer:

>> stats::Tdist(x, 3)
   
                /                                     /    1/2 \ \
                |                           1/2       | x 3    | |
                |     1/2                  3    arctan| ------ | |
            1/2 | PI 3           x                    \   3    / |
         2 3    | ------- + ------------ + --------------------- |
                |    4        /  2     \             2           |
                |             | x      |                         |
                |           2 | -- + 1 |                         |
                \             \ 3      /                         /
         ---------------------------------------------------------
                                   3 PI
      

An unevaluated call is returned, if the second argument is not a positive integer:

>> stats::Tdist(x, 3/2)
   
                           stats::Tdist(x, 3/2)
      
>> diff(%, x)
   
                                  1/2  1/2
                                PI    3
                       -----------------------------
                                     /    2     \5/4
                                   2 | 2 x      |
                       6 gamma(3/4)  | ---- + 1 |
                                     \  3       /
      

Example 3

We compute a floating point value via an intermediate exact result:

>> stats::Tdist(7/2, 20)
   
      /            /         1/2
      |        1/2 | 131072 5
      | 46189 5    | ----------- +
      \            \   230945
      
                                     1/2    1/2 \ \
         3673429330353857549533184 80    129    | |
         -------------------------------------- | | / 262144
              294717325313003652346374945       / /
      
>> float(%)
   
                               0.9988724384
      

It is more efficient to compute this value by a direct call with a floating point argument:

>> stats::Tdist(float(7/2), 20)
   
                               0.9988724384
      

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000