Home > wafo > wstats > dist2dfun.m

dist2dfun

PURPOSE ^

is an internal function to dist2dcdf dist2dprb.

SYNOPSIS ^

y=dist2dfun(H,V)

DESCRIPTION ^

 DIST2DFUN is an internal function to dist2dcdf dist2dprb.  
  
   CALL: y = dist2dfun(x2,x1) 
  
  Dependending on condon it returns a product of conditional  
  pdf and cdf. 
    condon = 0  returns p(X1,X2)=p(X2)*P( X1|X2)  
             1  returns p(X1)*p( X1|X2)  
             2  returns P( X1|X2)  
             3  returns p( X1|X2)  
  
  
    X1 and X2 must have equal size. 
    The size of P is the common size of the arguments X1 and X2. 
     
  GLOBALS used PHAT  CONDON 
  
  See also   dist2dcdf, dist2dprb

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function y=dist2dfun(H,V) 
002 %DIST2DFUN is an internal function to dist2dcdf dist2dprb.  
003 % 
004 %  CALL: y = dist2dfun(x2,x1) 
005 % 
006 % Dependending on condon it returns a product of conditional  
007 % pdf and cdf. 
008 %   condon = 0  returns p(X1,X2)=p(X2)*P( X1|X2)  
009 %            1  returns p(X1)*p( X1|X2)  
010 %            2  returns P( X1|X2)  
011 %            3  returns p( X1|X2)  
012 % 
013 % 
014 %   X1 and X2 must have equal size. 
015 %   The size of P is the common size of the arguments X1 and X2. 
016 %    
017 % GLOBALS used PHAT  CONDON 
018 % 
019 % See also   dist2dcdf, dist2dprb 
020  
021 % tested on: matlab 5.2 
022 % history: 
023 % pab 09.11.99 
024  
025  
026 global PHAT CONDON 
027 UDIST=lower(PHAT.dist{2}); 
028 CDIST=lower(PHAT.dist{1}); 
029 PH=PHAT.x{2}; 
030  
031  
032 [Av , Bv,Cv]=dist2dsmfun(PHAT,H); 
033 switch CONDON 
034   case {0,1} , % no conditional or conditional CDF given V 
035    switch UDIST(1:2) 
036     case 'ra',  pdf1= wraylpdf(H,PH); 
037     case 'we' ,  pdf1=wweibpdf(H,PH(1),PH(2)); 
038     case 'gu' ,  pdf1=wgumbpdf(H,PH(1),PH(2),0); 
039     case 'tg' ,  pdf1=wgumbpdf(H,PH(1),PH(2),1); 
040     case 'ga' ,  pdf1=wgampdf(H,PH(1),PH(2)); 
041     case 'gg',  pdf1=wggampdf(H,PH(1),PH(2),PH(3)); 
042     case 'lo' ,  pdf1=wlognpdf(H,PH(1),PH(2)); 
043     otherwise, error('unknown distribution') 
044    end  
045   case {2,3}, pdf1=1;%conditional CDF given H 
046 end 
047  
048 switch CONDON 
049   case {0,2} 
050     switch CDIST(1:2) 
051       case 'ra', y=pdf1.*wraylcdf(V-Cv,Av); 
052       case 'gu',y =  pdf1.*wgumbcdf(V-Cv,Av,Bv,0); 
053       case 'tg',  y =  pdf1.*wgumbcdf(V-Cv,Av,Bv,1); 
054       case 'lo', y =  pdf1.*wlogncdf(V-Cv,Av,Bv); 
055      case 'ga', y =  pdf1.*wgamcdf(V-Cv,Av,Bv);     
056       case 'gg', y =  pdf1.*wggamcdf(V,Av,Bv,Cv);     
057       case 'we', y =  pdf1.*wweibcdf(V-Cv,Av,Bv); 
058       otherwise, error('Unknown distribution') 
059     end 
060   case {1,3}, 
061    switch CDIST(1:2) 
062     case 'ra', y=pdf1.*wraylpdf(V-Cv,Av); 
063     case 'gu',y =  pdf1.*wgumbpdf(V-Cv,Av,Bv,0); 
064     case 'tg',  y =  pdf1.*wgumbpdf(V-Cv,Av,Bv,1); 
065     case 'lo', y =  pdf1.*wlognpdf(V-Cv,Av,Bv); 
066     case 'ga', y =  pdf1.*wgampdf(V-Cv,Av,Bv);     
067     case 'gg', y =  pdf1.*wggampdf(V,Av,Bv,Cv); 
068     case 'we', y =  pdf1.*wweibpdf(V-Cv,Av,Bv); 
069     otherwise, error('Unknown distribution') 
070    end 
071 end 
072  
073

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