(*  f_noncentral_cdf_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the derivative of the noncentral *)
(*    F CDF at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  13 January 2006 *)
(*  Author:  John Burkardt *)

Needs["Statistics`ContinuousDistributions`"]

avec={1,1,1,1,1,1,1,1,1,1,2,2,3,3,4,4,5,5,6,6,8,16};
bvec={1,5,5,5,5,5,5,5,5,5,5,10,5,5,5,5,1,5,6,12,16,8};
lambdavec={0,0,1/4,1,1,1,1,1,1,2,1,1,1,1,1,1,0,1,1,1,1,1};
xvec={1,1,1,1/2,1,2,3,4,5,1,1,1,1,2,1,2,1,1,1,1,2,1};
fvec = {};
num = Length [ xvec ];

Do [ {a=avec[[i]],b=bvec[[i]], lambda = lambdavec[[i]], x=SetPrecision[xvec[[i]],28],
dist=NoncentralFRatioDistribution[a,b,lambda],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  NoncentralFCDF[",a,",",b,",",lambda,",",x,"]=",N[f,16]] },{i,1,num,1}]

fileout=OpenWrite["C:\\Documents and Settings\\burkardt\\Desktop\\Misc\\mathematica\\f_noncentral_cdf_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  f_noncentral_cdf_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  a  b  lambda  x  fx"];
Write[fileout,"#"];
Do[{a=avec[[i]];b=bvec[[i]];lambda=lambdavec[[i]];x=xvec[[i]];f=fvec[[i]];Write[fileout,a,"  ",b,"  ",N[lambda,16],"  ",N[x,16],"  ",N[f,16]]},{i,1,num,1}];Close[fileout];