c -------------------------------------------------------------- c c finvt gives the two-tailed t percentage point c c author: fei-fei wei c c reference: hill (1970 cacm 13, 619-620) c c creation date: winter 1984 c c remark: max abs difference with mdsti less than c .6d-02 observed at 20 d.f. and p=.0004 c c input: c c t2 = two-tailed area c c n = degrees of freedom c c return: c c finvt = number such that the probability that the absolute c value of a t random variable with n d.f. will be c greater than finvt is equal to t2 c c -------------------------------------------------------------- doubleprecision function finvt(t2,n) implicit double precision(a-h,o-z) c6 implicit real*8(a-h,o-z) common/list9/sr2,pi,srpi,pib2 p=t2 if(n.ne.2)go to 1000 finvt=dsqrt(2.0d0/(p*(2.0d0-p))-2.0d0) return 1000 continue if(n.ne.1)go to 2000 p=p*pib2 finvt=dcos(p)/dsin(p) return 2000 dn=dfloat(n) a=1.0d0/(dn-0.5d0) b=48.0/(a*a) c=((20700.0d0*a/b-98.0d0)*a-16.0d0)*a+96.36d0 d=((94.5d0/(b+c)-3.0d0)/b+1.0d0)*dsqrt(a*pib2)*dn x=d*p y=x**(2.0d0/dn) pp=p*0.5d0 x=finvn(pp,ifault) if(y.le.0.5d0+a)go to 4000 y=x*x if(n.ge.5)go to 3000 c=c+0.3d0*(dn-4.5d0)*(x+0.6d0) 3000 c=(((0.05d0*d*x-5.0d0)*x-7.0d0)*x-2.0d0)*x+b+c y=(((((0.4d0*y+6.3d0)*y+36.0d0)*y+94.5d0)/c-y-3.0d0)/b+ *1.0d0)*x y=a*y*y if(y.le.0.002d0)go to 3500 y=dexp(y)-1.0d0 go to 5000 3500 y=0.5d0*y*y+y go to 5000 4000 y=((1.0d0/(((dn+6.0d0)/(dn*y)-0.089d0*d-0.822d0)*(dn+2.0d0)* *3.0d0)+0.5d0/(dn+4.0d0))*y-1.0d0)*(dn+1.0d0)/(dn+2.0d0)+ *1.0d0/y 5000 finvt=dsqrt(dn*y) return end c