macro Fnoncent F a b lambda cdf #F is the input F value #a and b are num and denom degrees of freedom #lambda is the noncentrality parameter #cdf if the response, the left tail area under the noncentral F d'n #Example calling statement # mtb> %Fnoncent 2.8 4 28 12 k1 #Test this macro with the following Minitab command: # mtb> cdf 2.8 k1; # subc> f 4 28 12. #Minitab returns 0.2940 and the macro returns 0.293986. #This macro calculates the noncentral F probability using the #algorithm from AMS55 p. 947 26.6.20. (There is a typo in the 9th #printing of AMS55 - this function is P(F;df1,df2,lambda). The #algorithm runs very slowly because it must make repeated calls to #the IncBeta macro. #by Paul G. Mathews 15 March 2001 #Copyright (c) PGMathews March 2001 All rights reserved mconstant F a b lambda cdf x p q Bx err poi n lastcdf note note This macro runs very slowly. Please be patient. note Running macro ... brief 0 let x=a*F/(a*F+b) let p=a/2 let q=b/2 let lambda=lambda/2 #the value of lambda is changed!!! %IncBeta x p q Bx let cdf=exp(-lambda)*Bx #0th term in the expansion let err=1 let n=1 while err>0.00001 let lastcdf=cdf pdf n poi; poisson lambda. let p=a/2+n %IncBeta x p q Bx let cdf=cdf+poi*Bx let err=abs(1-lastcdf/cdf) let n=n+1 print n cdf endwhile let lambda=lambda*2 #now it's changed back brief print cdf endmacro