Home > wafo > wstats > wfcdf.m

# wfcdf

## PURPOSE

Snedecor's F cumulative distribution function

F = wfcdf(x,a,b)

## DESCRIPTION

WFCDF  Snedecor's F cumulative distribution function

CALL:  F = wfcdf(x,df1,df2);

F = distribution function evaluated at x
x = matrix
df1,df2 = degrees of freedom (1,2,....)

Example:
x  = linspace(0,6,200);
p1 = wfcdf(x,1,1); p2 = wfcdf(x,2,2);
plot(x,p1,x,p2)

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wbetacdf Beta cumulative distribution function error Display message and abort function. nan Not-a-Number. warning Display warning message; disable or enable warning messages.
This function is called by:
 wtcdf Student's T cumulative distribution function

## SOURCE CODE

001 function F = wfcdf(x,a,b)
002 %WFCDF  Snedecor's F cumulative distribution function
003 %
004 % CALL:  F = wfcdf(x,df1,df2);
005 %
006 %        F = distribution function evaluated at x
007 %        x = matrix
008 %  df1,df2 = degrees of freedom (1,2,....)
009 %
010 % Example:
011 %   x  = linspace(0,6,200);
012 %   p1 = wfcdf(x,1,1); p2 = wfcdf(x,2,2);
013 %   plot(x,p1,x,p2)
014
015 % tested on matlab 5.3
016 %History:
017 %revised pab 29.10.2000
019 % -added nargchk, comnsize +  check on floor(df)==df
020 %        Anders Holtsberg, 18-11-93
021 %        Copyright (c) Anders Holtsberg
022
023
024 error(nargchk(3,3,nargin))
025 [errorcode x,a,b] = comnsize(x,a,b);
026 if errorcode>0,
027   error('x, df1 and df2 must be of common size or scalar');
028 end
029
030 F = zeros(size(x));
031
032 ok = (a>0 & b>0 & floor(a)==a & floor(b)==b);
033 k=find(ok & x>=0 & x<inf);
034 if any(k),
035   F(k) = wbetacdf(x(k)./(x(k)+b(k)./a(k)),a(k)/2,b(k)/2);
036 end
037
038 k1=find(ok &  x==inf);
039 if any(k1),
040   F(k1) =ones(size(k1));
041 end
042
043
044 k2 = find(~ok);
045 if any(k2)
046   warning('df1 and df1 must be positive integers.')
047   f(k2)=NaN;
048 end
049
050

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003