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

Needs["Statistics`ContinuousDistributions`"]

avec = {1,1,5,1,2,4,1,6,8,1,3,6,1,1,1,
1,2,3,4,5};
bvec = {1,5,1,5,10,20,5,6,16,5,10,12,5,5,5, 5,5,5,5,5 };
xvec = {1,528/1000,189/100,169/100,160/100,147/100,406/100,305/100,209/100,661/100,371/100,3,1001/100,1616/100,2278/100,4718/100,1,1,1,1};
fvec = {};
num = Length [ xvec ];

Do [ {  
a = avec[[i]], b = bvec[[i]],x=xvec[[i]],
f = CDF [ FRatioDistribution[a,b],x],
fvec = Append[fvec,f],
 Print[ "f[", a, ", ",b, ",",x,"] = ",N[f,16]] 
}, {i,1,num,1} ]

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