Home > wafo > wstats > mdist2dcdf.m

mdist2dcdf

PURPOSE ^

Joint 2D CDF due to Plackett

SYNOPSIS ^

y = mdist2dcdf(V,H,phat,condon)

DESCRIPTION ^

 MDIST2DCDF Joint 2D CDF due to Plackett 
 
  CALL F = mdist2dcdf(x1,x2,phat,condon) 
 
      F  = the cdf evalutated at points (x1 , x2) 
           with the parameters Phat1, Phat2 and Psi.
    phat = parameter structure containing
           x{1} = Phat1 marginal parameters of x1
           x{2} = Phat2 marginal parameters of x2
           x{3} = Psi the interaction parameter between x1 and x2.
           dist = list of marginal distributions of x1 and x2, respectively 
                  Options are: 'tgumbel', 'gumbel', 
                 'lognormal','rayleigh','weibull','gamma'.
  condon = 0 regular cdf is returned (default)
           1 conditional cdf of H given V is returned
           2 conditional cdf of V given H is returned
 
  Example: 2D Weibull Rayleigh with marginal parameters [2 3] and 3,
    % respectively and interaction parameter of 10 : 
    phat.x={[2 3],3,10};
    phat.dist={'weibull','rayleigh'};
    F = mdist2dcdf(3,4,phat);
  
  See also   mdist2dpdf, mdist2dfit, mdist2drnd

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

001 function y = mdist2dcdf(V,H,phat,condon)
002 %MDIST2DCDF Joint 2D CDF due to Plackett 
003 %
004 % CALL F = mdist2dcdf(x1,x2,phat,condon) 
005 %
006 %     F  = the cdf evalutated at points (x1 , x2) 
007 %          with the parameters Phat1, Phat2 and Psi.
008 %   phat = parameter structure containing
009 %          x{1} = Phat1 marginal parameters of x1
010 %          x{2} = Phat2 marginal parameters of x2
011 %          x{3} = Psi the interaction parameter between x1 and x2.
012 %          dist = list of marginal distributions of x1 and x2, respectively 
013 %                 Options are: 'tgumbel', 'gumbel', 
014 %                'lognormal','rayleigh','weibull','gamma'.
015 % condon = 0 regular cdf is returned (default)
016 %          1 conditional cdf of H given V is returned
017 %          2 conditional cdf of V given H is returned
018 %
019 % Example: 2D Weibull Rayleigh with marginal parameters [2 3] and 3,
020 %   % respectively and interaction parameter of 10 : 
021 %   phat.x={[2 3],3,10};
022 %   phat.dist={'weibull','rayleigh'};
023 %   F = mdist2dcdf(3,4,phat);
024 % 
025 % See also   mdist2dpdf, mdist2dfit, mdist2drnd
026 
027 % references:
028 % Plackett, R. L. (1965) "A class of bivariate distributions."
029 %                                J. Am. Stat. Assoc. 60. 516-22
030 %      [1]  Michel K. Ochi,
031 %       OCEAN TECHNOLOGY series 6
032 %      "OCEAN WAVES, The stochastic approach", Cambridge
033 %      1998 p. 133-134.
034 
035 %  tested on: matlab 5.2
036 % history
037 % revised pab 8.11.1999
038 %  - updated header info
039 %  - changed phat from vectro to structure
040 %  Per A. Brodtkorb 28.01.99
041 
042 error(nargchk(3,4,nargin))
043 if nargin <4 |isempty(condon), condon =0;end
044 
045 [errorcode V H ] = comnsize(V,H);
046 if  errorcode > 0
047   error('x1 and x2 must be of common size or scalar.');
048 end
049 
050 VDIST=lower(phat.dist{1});
051 HDIST=lower(phat.dist{2});
052 
053 psi=phat.x{3};
054 PV=phat.x{1};
055 PH=phat.x{2};
056  
057 
058 
059 y = zeros(size(V));
060 
061 
062 if strcmp('gu', VDIST(1:2)),
063   if strcmp('gu',HDIST(1:2)),
064     k=find(H>-inf&V>-inf);
065   else
066    k=find(H>0&V>-inf);
067   end
068 elseif strcmp('gu',HDIST(1:2)),
069   k = find(H>-inf & V > 0 );
070 else
071   k = find( H>0 &V > 0);
072 end
073 
074 if any(k),  
075   Fh=dist1dcdffun(H(k),PH,HDIST(1:2) ); 
076   Fv=dist1dcdffun(V(k),PV,VDIST(1:2) ); 
077   tmp=1+(Fv+Fh).*(psi-1);
078   y(k)=(tmp-sqrt(tmp.^2-4.*psi.*(psi-1).*Fv.*Fh))./(2.*(psi-1));
079   switch condon
080     case 0, 
081     case 1, y(k)=0.5-0.5.*(tmp-2.*psi.*Fh)./sqrt(tmp.^2-4.*psi.*(psi-1).*Fv.*Fh);
082     case 2, y(k)=0.5-0.5.*(tmp-2.*psi.*Fv)./sqrt(tmp.^2-4.*psi.*(psi-1).*Fv.*Fh);
083   end
084 end
085 
086 return
087 
088 function cdf1=dist1dcdffun(H,Ah,dist2 )  
089    switch dist2(1:2)
090       case 'ra',  cdf1=wraylcdf(H,Ah);
091       case 'we' ,  cdf1=wweibcdf(H,Ah(1),Ah(2));
092       case 'gu' ,  cdf1=wgumbcdf(H,Ah(1),Ah(2),0);
093       case 'tg' ,  cdf1=wgumbcdf(H,Ah(1),Ah(2),1);
094       case 'ga' ,  cdf1=wgamcdf(H,Ah(1),Ah(2));
095       case 'lo' ,  cdf1=wlogncdf(H,Ah(1),Ah(2));
096       otherwise, error('unknown distribution')
097     end 
098 return
099 
100 
101

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