1
DOUBLE PRECISION FUNCTION dt1(p,q,df)
2
C**********************************************************************
4
C DOUBLE PRECISION FUNCTION DT1(P,Q,DF)
5
C Double precision Initalize Approximation to
6
C INVerse of the cumulative T distribution
12
C Returns the inverse of the T distribution function, i.e.,
13
C the integral from 0 to INVT of the T density is P. This is an
14
C initial approximation
20
C P --> The p-value whose inverse from the T distribution is
22
C P is DOUBLE PRECISION
25
C Q is DOUBLE PRECISION
27
C DF --> Degrees of freedom of the T distribution.
28
C DF is DOUBLE PRECISION
30
C**********************************************************************
32
C .. Scalar Arguments ..
33
DOUBLE PRECISION df,p,q
36
DOUBLE PRECISION denpow,sum,term,x,xp,xx
40
DOUBLE PRECISION coef(5,4),denom(4)
43
C .. External Functions ..
44
DOUBLE PRECISION dinvnr,devlpl
45
EXTERNAL dinvnr,devlpl
47
C .. Intrinsic Functions ..
50
C .. Data statements ..
51
DATA (coef(i,1),i=1,5)/1.0D0,1.0D0,3*0.0D0/
52
DATA (coef(i,2),i=1,5)/3.0D0,16.0D0,5.0D0,2*0.0D0/
53
DATA (coef(i,3),i=1,5)/-15.0D0,17.0D0,19.0D0,3.0D0,0.0D0/
54
DATA (coef(i,4),i=1,5)/-945.0D0,-1920.0D0,1482.0D0,776.0D0,79.0D0/
56
DATA denom/4.0D0,96.0D0,384.0D0,92160.0D0/
58
C .. Executable Statements ..
64
term = devlpl(coef(1,i),ideg(i),xx)*x
66
sum = sum + term/ (denpow*denom(i))
68
IF (.NOT. (p.GE.0.5D0)) GO TO 20