# Student's t Distribution

 Probability Home Student's t Distribution

The distribution function of a random variable X distributed according to the Student's t distribution with n ≥ 1 degrees of freedom is a continuous function, F(x) = P(X < x), given by
F(x) =
 [ 1 / ( n½ B(1/2,n/2) ) ] ∫-∞x (1 + t² / n) -(n+1) / 2 dt

where B() is the beta function.

The corresponding probability density function, f(x) = dF(x)/dx, is
f(x) =
 [ 1 / ( n½ B(1/2,n/2) ) ] (1 + x² / n) -(n+1) / 2

For a large number of degrees of freedom, n >> 1, the distribution of
 [ X ( 1 - 1 / ( 4n ) ) ] / √[ 1 + X2 / ( 2n ) ]
approaches that of a standard normal distribution. The problem of deciding how large n should be depends on the nature of the problem.

The two-sided Student's t distribution is given as
 A(x) = P( -x < X < x ) = P( |X| < x )
where X has a Student's t distribution and x ≥ 0.

#### Function List

• double Student_t_Distribution( double x, int n )

This function returns F(x) where F(x) is described above.

• double Student_t_Density( double x, int n )

This function returns f(x) where f(x) is described above.

• void Student_t_Distribution_Tables( int n, double start, double delta,int nsteps, double *density, double* distribution_function )

This function returns f(x) where f(x) is described above in the array density, i.e. density[i] = f(xi) where xi = start + i delta, i = 0,...,nsteps and returns F(x) where F(x) is described above in the array distribution_function, i.e. distribution_function[i] = F(xi) where xi = start + i delta, i = 0,...,nsteps. Note that density must be declared double density[N] where N ≥ nsteps + 1 in the calling routine and similarly the distribution_function must be declared double distribution_function[N] where
N ≥ nsteps + 1 in the calling routine.

• double Student_t_Distribution_Large_dof( double x, int n )

This function returns the asymptotic distribution of F(x) for a large number of degrees of freedom, n.

• double Absolute_Student_t_Distribution( double x, int n )

This function returns A(|x|) where A(x) is described above.

• double Absolute_Student_t_Distribution_Large_dof( double x, int n )

This function returns the asymptotic distribution of A(|x|) for a large number of degrees of freedom, n.

#### Source Code

C source code is available for these routines:
• The file, student_t_distribution.c, contains the source code for the function Student_t_Distribution.

Dependencies: In addition to the the file student_t_distribution.c, the function Student_t_Distribution() requires the following files:

• The file, student_t_density.c, contains the source code for the function Student_t_Density.

Dependencies: In addition to the the file student_t_density.c, the function Student_t_Density() requires the following files:

• The file, student_t_dist_tables.c, contains the source code for the function Student_t_Distribution_Tables.

Dependencies: In addition to the the file student_t_dist_tables.c, the function Student_t_Distribution_Tables() requires the following files:

• The file student_t_distribution.c and its dependencies given above.
• The file student_t_density.c and its dependencies given above.

• The file, student_t_distribution_large_dof.c, contains the source code for the function Student_t_Distribution_Large_dof.

Dependencies: In addition to the file student_t_distribution_large_dof.c, the function Student_t_Distribution_Large_dof() requires the following file:

• The file, abs_student_t_distribution.c, contains the source code for the function Absolute_Student_t_Distribution

Dependencies: In addition to the the file abs_student_t_distribution.c, the function Absolute_Student_t_Distribution() requires the following files:

• The file, abs_student_t_distribution_large_dof.c, contains the source code for the function Absolute_Student_t_Distribution_Large_dof.

Dependencies: In addition to the file abs_student_t_distribution_large_dof.c, the function Absolute_Student_t_Distribution_Large_dof() requires the following file:

#### C Test Code, Test Results, and Build Shell Script

• The file, teststudenttbook.c, contains a test program of Student_t_Distribution( ), Student_t_Density(), and Absolute_Student_t_Distribution() written in C. This test program requires the files student_t_distribution.c, student_t_density.c, abs_student_t_distribution.c, and their dependencies listed above.

• The file, StudenttDistributionBook.txt, contains the results of the test program teststudenttbook.c.

• The file, teststudenttbook.sh, contains the shell script used to compile, link, and execute the test program teststudenttbook.c.

• The file, teststudenttdist.c, contains a test program of Student_t_Distribution( ) written in C. This test program requires the file student_t_distribution.c and its dependencies listed above.

• The file, StudenttDistributionTest.txt, contains the results of the test program teststudenttdist.c.

• The file, teststudenttdist.sh, contains the shell script used to compile, link, and execute the test program teststudenttdist.c.

• The file, teststudenttdensity.c, contains a test program of Student_t_Density( ) written in C. This test program requires the file student_t_density.c and its dependencies listed above.

• The file, StudenttDensityTest.txt, contains the results of the test program teststudenttdensity.c.

• The file, teststudenttdensity.sh, contains the shell script used to compile, link, and execute the test program teststudenttdensity.c.

• The file, teststudentttables.c, contains a test program of Student_t_Distribution_Tables( ) written in C. This test program requires the files student_t_distribution.c, student_t_density.c, and their dependencies listed above.

• The file, StudenttTablesTest.txt, contains the results of the test program teststudentttables.c.

• The file, teststudentttables.sh, contains the shell script used to compile, link, and execute the test program teststudentttables.c.

• The file, teststudenttasymptotic.c, contains a test program of Student_t_Distribution_Large_dof( ) written in C. This test program requires the files student_t_distribution_large_dof.c, student_t_distribution.c and their dependencies listed above.

• The file, StudenttDistributionAsymptoticTest.txt, contains the results of the test program teststudenttasymptotic.c.

• The file, teststudenttasymptotic.sh, contains the shell script used to compile, link, and execute the test program teststudenttasymptotic.c.

• The file, testabsstudenttasymptotic.c, contains a test program of Absolute_Student_t_Distribution_Large_dof( ) written in C. This test program requires the files abs_student_t_distribution_large_dof.c and its dependencies listed above.

• The file, AbsStudenttDistributionAsymptoticTest.txt, contains the results of the test program testabsstudenttasymptotic.c.

• The file, testabsstudenttasymptotic.sh, contains the shell script used to compile, link, and execute the test program testabsstudenttasymptotic.c.