Home > wafo > wstats > winvgcdf.m

winvgcdf

PURPOSE ^

Inverse Gaussian cumulative distribution function

SYNOPSIS ^

F = winvgcdf(x,m,l);

DESCRIPTION ^

 WINVGCDF Inverse Gaussian cumulative distribution function
 
  CALL:  F = winvgcdf(x,m,l);
 
         F = distribution function evaluated at x
       m,l =parameters
 
  The Inverse Gaussian distribution is defined by its pdf
 
         f(x)=(l/(2*pi*x^3))^(1/2)*exp(-l*(x-m)^2/(2*m^2*x)), x>0.
 
  Example: 
    x = linspace(0,3,200);
    p1 = winvgcdf(x,1,1); p2 = winvgcdf(x,1,.25);
    plot(x,p1,x,p2)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function F = winvgcdf(x,m,l);
002 %WINVGCDF Inverse Gaussian cumulative distribution function
003 %
004 % CALL:  F = winvgcdf(x,m,l);
005 %
006 %        F = distribution function evaluated at x
007 %      m,l =parameters
008 %
009 % The Inverse Gaussian distribution is defined by its pdf
010 %
011 %        f(x)=(l/(2*pi*x^3))^(1/2)*exp(-l*(x-m)^2/(2*m^2*x)), x>0.
012 %
013 % Example: 
014 %   x = linspace(0,3,200);
015 %   p1 = winvgcdf(x,1,1); p2 = winvgcdf(x,1,.25);
016 %   plot(x,p1,x,p2)
017 
018 
019 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
020 % and Life Span Models", p. 259 ff, Marcel Dekker.
021 
022 
023 
024 % Tested on; Matlab 5.3
025 % History: 
026 % revised pab 24.10.2000
027 %  - added comnsize, nargchk
028 % added ms 14.08.2000
029 
030 error(nargchk(3,3,nargin))
031 %if nargin<2|isempty(m),  m=0;  end
032 %if nargin<3|isempty(l),  l=1;  end
033 
034 [errorcode, x, m, l] = comnsize (x,m, l);
035 if (errorcode > 0)
036   error ('x, m and l must be of common size or scalar');
037 end
038 
039 F=zeros(size(x));
040 ok=((m>0)&(l>0));
041 
042 k=find(x>0& ok);
043 if any(k)
044   F(k)=(wnormcdf((l(k)./x(k)).^(1/2).*(x(k)./m(k)-1),0,1)+...
045       exp(2*l(k)./m(k)).*wnormcdf(-(l(k)./x(k)).^(1/2).*(x(k)./m(k)+1),0,1));
046 end
047 
048 k1 = find (~ok);
049 if any (k1)
050   tmp=NaN;
051   F(k1) = tmp(ones(size(k1)));
052 end
053 
054 
055 
056 
057

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