Student's T distribution PDF.

View versions (1)

Interface

#include <codecogs/statistics/distributions/continuous/t/pdf.h>

using namespace Statistics::Distributions::Continuous::T;

Computes the probability density function of the Student T distribution with integer k > 0 degrees of freedom:

\frac{ \Gamma((k + 1)/2 }
    	 { \sqrt{k\pi} \Gamma(k/2) (1 + x^2 / k) ^ {(k+1) / 2}}
(1)

The T distribution has PDF and as shown below, denoted P(x):

\graph t=-2.5:2.5 k=1:5:1

Example:

#include <stdio.h>
#include <codecogs/statistics/distributions/continuous/t/pdf.h>
using namespace Stats::Dists::Continuous::T;

int main()
{
  for( double t=-2.5; t<2.5; t+=0.5 )
    printf(  "PDF( %1.1f ) = %f \n", t, PDF(t, 20)  );
  return getchar();
}

Output:

PDF( -2.5 ) = 0.022669
PDF( -2.0 ) = 0.058087
PDF( -1.5 ) = 0.128627
PDF( -1.0 ) = 0.236046
PDF( -0.5 ) = 0.345809
PDF( 0.0 ) = 0.393989
PDF( 0.5 ) = 0.345809
PDF( 1.0 ) = 0.236046
PDF( 1.5 ) = 0.128627
PDF( 2.0 ) = 0.058087

Parameters

t
the point at which to evaluate the PDF
k
the number of degrees of freedom of the T distribution
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

t
k
Result