Chapter 4: zero-one loss/risk
In the lefthand column of plots (a), we define three posterior distributions for landing positions of the arrow, when the location of the aimpoint is nominally zero (upper plot). We then ask, via a decision-theoretic analysis making use of the zero-one loss function, ‘by how much should we shift these (nominally unshifted) probability distributions to minimize risk?’. We see (lower plot) that the triangular posterior need not be shifted, because its minimum risk-point is at zero. To minimize risk with the other two distributions, one must be shifted positively and one negatively (by 1 and -1.5 units, respectively).
%zero-one loss / risk lefthand (a) panel
figure(1); clf
thetas=linspace(-3,3,1200);
Tlist=[.01 .025]; hlist=[.4 .2]; grylist=[.0 .5 .75]; collist=[.2 .3 .6; .4 .5 .9]; LW=1.4; xminmax=[-2.5 2.5];
for iT=1:length(Tlist), T=Tlist(iT); subplot(2,1,1), hold on
plist=[zeros(1,sum(thetas<-1)) linspace(0,1,sum(and(thetas<=0,thetas>=-1))) linspace(1,0,sum(and(thetas<=1,thetas>0))) zeros(1,sum(thetas>1))];
plot(thetas,plist,'.','Color',grylist(1)*[1 1 1])
plot(-T*iT*[1 1],[0 hlist(iT)],'-','Color',collist(iT,:),'LineWidth',LW);
plot(T*iT*[1 1],[0 hlist(iT)],'-','Color',collist(iT,:),'LineWidth',LW);
plot([-T T]*iT,hlist(iT)*[1 1],'-','Color',collist(iT,:),'LineWidth',LW);
subplot(2,1,2); hold on
ptot=sum(plist);
plot(xminmax,[1 1],'k--','LineWidth',1.8)
r=nan(size(plist));
for inow=1:length(thetas), dtheta=thetas(inow);
iset=find(abs(thetas+dtheta)<=T);
r(inow)=ptot-sum(plist(iset)); end
plot(thetas,r/ptot,'.','Color',grylist(1)*[1 1 1]); rmin=mean(r(isnear(r,min(r))))/ptot;
plot(mean(thetas(isnear(r,min(r)))),rmin,'ko','MarkerFaceColor',collist(iT,:),'MarkerSize',8);
subplot(2,1,1); hold on
plist=npdf(thetas,0,1);
plist=plist+npdf(thetas,-1,.25); plist=plist/max(plist);
plot(thetas,plist,'.','Color',grylist(2)*[1 1 1]);
subplot(2,1,2); hold on
ptot=sum(plist);
plot(xminmax,[1 1],'k--','LineWidth',1.8)
r=nan(size(plist));
for inow=1:length(thetas), dtheta=thetas(inow);
iset=find(abs(thetas+dtheta)<T);
r(inow)=ptot-sum(plist(iset)); end
plot(thetas,r/ptot,'.','Color',grylist(2)*[1 1 1]);
plot(thetas(isnear(r,min(r))),r(isnear(r,min(r)))/ptot,'ko','MarkerFaceColor',collist(iT,:),'MarkerSize',8);
subplot(2,1,1), hold on
thetas=linspace(-3,3,1200);
plist=[zeros(1,700) linspace(0,1,200)]; plist=[plist(1:end-1) linspace(1,0,201) zeros(1,100)];
plist=plist+npdf(thetas,.5,.5); plist=plist/max(plist);
plot(thetas,plist,'.','Color',grylist(3)*[1 1 1]);
subplot(2,1,2); hold on
ptot=sum(plist);
plot(xminmax,[1 1],'k--','LineWidth',1.8)
for inow=1:length(thetas), dtheta=thetas(inow);
iset=find(abs(thetas+dtheta)<T);
r(inow)=ptot-sum(plist(iset)); end
plot(thetas,r/ptot,'.','Color',grylist(3)*[1 1 1]);
plot(thetas(isnear(r,min(r))),r(isnear(r,min(r)))/ptot,'ko','MarkerFaceColor',collist(iT,:),'MarkerSize',8); end
subplot(2,1,1); axis([-2.5 2.5 0 1])
subplot(2,1,2); axis([-2.5 2.5 .999*rmin 1])
In the righthand column of plots (b) we plot three risk functions, each one associated with a different target-width but with the same posterior probability over arrow endpoints, and all using the zero-one loss function. Here, the minimum risk point tells us which location along the theta axis to choose as our measurement of the (as-yet unseen) arrow endpoint.
%zero-one loss / risk righthand (b) panel
%estimate = peak
%
Tlist=[.01 .025 .075]; hlist=[.4 .2 .075]; grylist=[.4 .6 .8]; collist=[.2 .3 .6; .3 .4 .8; .4 .5 .9]; LW=1.4; xminmax=[-3 3];
thetas=linspace(-3,3,1200);
plist=npdf(thetas,1,1);
plist=plist+npdf(thetas,-0,.25); plist=plist/max(plist);
figure(1); clf;
%plot distribution of
subplot(2,1,1); hold on
plot(thetas,plist/max(plist),'k.')
%plot squares for target radii
for iT=1:length(Tlist), T=Tlist(iT);
plot(-T*iT*[1 1]-2,[0 hlist(iT)],'-','Color',grylist(iT)*[1 1 1],'LineWidth',LW);
plot(T*iT*[1 1]-2,[0 hlist(iT)],'-','Color',grylist(iT)*[1 1 1],'LineWidth',LW);
plot([-T T]*iT-2,hlist(iT)*[1 1],'-','Color',grylist(iT)*[1 1 1],'LineWidth',LW); end
axis([xminmax 0 1])
%plot risk function for each target
subplot(2,1,2); hold on
ptot=sum(plist);
plot(xminmax,[1 1],'k--','LineWidth',1.8)
for iT=1:length(Tlist), T=Tlist(iT);
ir=find(abs(thetas<=2));r=nan(size(ir));
for inow=1:length(ir), dtheta=thetas(ir(inow));
iset=find(and(thetas>=dtheta-T,thetas<=dtheta+T));
r(inow)=ptot-sum(plist(iset)); end
plot(thetas(ir),r/ptot,'.','Color',grylist(iT)*[1 1 1]); plot(mean(thetas(isnear(r,min(r)))),r(isnear(r,min(r)))/ptot,'ko','MarkerFaceColor',collist(iT,:),'MarkerSize',8); end
axis([xminmax .85 1]); axis off