Student's t-Distribution

Author

Eric W. Weisstein
May 2, 2006

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/Studentst-Distribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Studentst-Distribution.html.

©2006 Wolfram Research, Inc. except for portions noted otherwise

Plots

Show[GraphicsArray[
Plot[#[StudentTDistribution[1],x],{x,-10,10},AxesLabel->TraditionalForm/@{x,#[x]},Ticks->None,
PlotStyle->Red,DisplayFunction->Identity,PlotRange->All]&/@{PDF,CDF}
],ImageSize->500]

Stats

Stats[StudentTDistribution[n],x]//StatsForm//TraditionalForm

PDF

{f1=Gamma[(r+1)/2]/(Sqrt[r Pi]Gamma[r/2](1+t^2/r)^((r+1)/2)),
f2=(r/(r+t^2))^((1+r)/2)/Sqrt[r]/Beta[r/2,1/2]}

FullSimplify[Subtract@@{f1,f2},t>0&&r>0]

CDF

CDF[StudentTDistribution[r],t]

Integrate[Gamma[(r+1)/2]/(Sqrt[r Pi]Gamma[r/2](1+tp^2/r)^((r+1)/2)),
	{tp,-∞,t},Assumptions->r>0&&t∈Reals]

FullSimplify[%,r>0&&t∈Reals]

Integrate[Gamma[(r+1)/2]/(Sqrt[r Pi]Gamma[r/2](1+tp^2/r)^((r+1)/2)),
	{tp,-∞,t},Assumptions->r>0]

FullSimplify[%,r>0]

TraditionalForm[cdf={
(1/2) (1+BetaRegularized[(r/(r+(t^2))),1,(r/2),(1/2)] Sign[t]),
(1/2) (1+((Beta[(r/(r+(t^2))),1,(r/2),(1/2)])/(Beta[(r/2),(1/2)])) Sign[t]),
(1/2)-((I t Beta[-((t^2)/r),(1/2),(1/2)-(r/2)] Gamma[((1+r)/2)])/(2 (Sqrt[π]) Abs[t] Gamma[(r/2)])),
(1/2)+((t Gamma[((1+r)/2)] Hypergeometric2F1[(1/2),((1+r)/2),(3/2),-((t^2)/r)])/((Sqrt[π]) (Sqrt[r]) Gamma[(r/2)]))
}]

FunctionExpand[BetaRegularized[(r/(r+(t^2))),1,(r/2),(1/2)] ]

FunctionExpand[Beta[a,b]]

FullSimplify[Subtract@@@Partition[cdf,2,1],r>0&&t∈Reals]

Table[cdf/.{t->Random[Real,{-10,10}],r->Random[Integer,{1,20}]},{20}]//Chop

Confidence Intervals

StudentCI[n_,CI_]:=Module[{x},
x/.FindRoot[CDF[StudentTDistribution[n],x]==CI,{x,1,2},WorkingPrecision->20]
]

r={1,2,3,4,5,10,30,100,99999};
TableForm[
N[Table[StudentCI[r[[i]],#]&/@{9/10,95/100,975/1000,995/1000},{i,Length[r]}],6],TableAlignments->Left]

StudentCI[30,995/1000]

Solve[Refine[CDF[StudentTDistribution[30],x],x>0]==995/1000,x]

FindRoot[CDF[StudentTDistribution[30],x]==995/1000,{x,2,3},WorkingPrecision->30]

(2+3/4-x/.%)

Characteristic Functions

f[n_]:=FourierTransform[PowerExpand[(((((n/(n+(x^2)))))^((1+n)/2))/((Sqrt[n]) Beta[(n/2),(1/2)]))],x,t]

FullSimplify[Table[f[n],{n,7}]]//TableForm

(% /.{t Sign[t]->Abs[t],Conjugate[t]->t})/. t Sign[t]->Abs[t]//TableForm

Show[GraphicsArray[Partition[Table[Plot[Evaluate[f[n]],{t,-4,4},Ticks->None,DisplayFunction->Identity],{n,8}],4]
]]