001 function dist2dparamplotdist2dparamplot(PV1,sPV1,plotflag),
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036 if nargin<3|isempty(plotflag)
037 plotflag=4;
038 elseif plotflag<1
039 return
040 end
041 Npv = prod(size(PV1));
042 ih=ishold;
043 if isstruct(PV1) & Npv>1
044 cfig=gcf;
045 for ix=1:Npv,
046 if ih
047 newplot
048 else
049 figure(cfig-1+ix)
050 end
051 if nargin<2|isempty(sPV1)
052 dist2dparamplot(PV1(ix),[],plotflag)
053 else
054 dist2dparamplot(PV1(ix),sPV1(ix),plotflag)
055 end
056 end
057 return
058 end
059
060
061 if nargin<2|isempty(sPV1)
062 sPV=[];
063 elseif isstruct(sPV1)
064 sPV=sPV1.x{1};
065 else
066 sPV=sPV1;
067 end
068
069 dist=lower(PV1.dist{1});
070 if isfield(PV1,'CI') & ~isempty(PV1.CI);
071 pvCI=PV1.CI{1};
072 indCI=find(~isnan(pvCI(:,1)));
073 isCI=any( pvCI(indCI,1:2:end));
074 isCI=[isCI zeros(1,3-length(isCI))];
075 else
076 isCI=zeros(1,3);
077 end
078 txtCI=' and 95 % CI';
079
080 pv=PV1.x{1};
081 np=size(pv,2)-1;
082
083 ind=find(~isnan(pv(:,1)));
084
085 Arange=[0 inf 0 inf];Brange=[0 inf -inf inf];Crange=[0 inf -inf inf];
086 switch lower(dist(1:2)),
087 case {'tg','gu'}, txt='Gumbel';
088 case 'lo', txt='Lognormal';Arange=[0 inf -inf inf];Brange=[0 inf 0 inf];
089 case 'ga', txt='Gamma';Brange=[0 inf 0 inf];
090 case 'gg', txt='Generalized Gamma';Brange=Arange;Crange = Arange;
091 case 'we', txt='Weibull';Brange=[0 inf 0 inf];
092 otherwise, txt=[];
093 end
094 Arange(4)= min(max(pv(ind,2)),20);
095 if np>1, Brange(4)=min(max(pv(ind,3)),20);
096 if np>2, Crange(4)=min(max(pv(ind,4)),5);end
097 end
098
099
100
101 paramtxt='ABC';
102 if strcmpi(dist(1:2),'ra'),
103 paramtxt(2)=[];
104 Prange={Arange, Crange};
105 else
106 Prange={Arange, Brange, Crange};
107 end
108 if plotflag>np,
109 nplots=1:np;
110 else
111 nplots=plotflag;np=1;
112 end
113
114 for ix=nplots,
115
116 subplot(np,1,ix-nplots(1)+1)
117 if ih , hold on, end
118 plot(pv(ind,1),pv(ind,ix+1),'bo'), hold on
119 if isCI(ix)
120 plot(pv(indCI,1),pvCI(indCI,2*ix-1:2*ix),'r--')
121 title([txt ' parameter ' paramtxt(ix) txtCI])
122 else
123 title([txt ' parameter ' paramtxt(ix)])
124 end
125
126 if ~isempty(sPV),
127 plot(sPV(:,1),sPV(:,ix+1),'b-')
128 end
129 if ~ih, hold off, end
130 axis(Prange{ix})
131 xlabel('x2')
132 ylabel([paramtxt(ix) '(x2)'])
133 end
134 return
135