Chapter 5: d-prime
Chapter 5: d-prime
To compute d-prime we will proceed in three steps. First we must compute probability distributions over hit and false alarm rates based on the binomial likelihood:
N=50; hits=round(N*.8414); fa=round(N*.5); %criterion at 0 for dprime=1 case
pri=@(x) ones(size(x)); %uniform prior
ftx=@(x) ninv(x); %cumulative inverse normal transform
Fnum=1;
figure(Fnum); clf
subplot(2,1,1); hold on;
[~, ~, Lhit]=Lrate([hits N],pri,Fnum);
[~, ~, Lfa]= Lrate([fa N],pri);
%and then z-transform these rates:
[Lhit]=LTX(Lhit(:,2),(Lhit(:,1)),ftx);
[Lfa ]=LTX(Lfa(:,2) ,(Lfa(:,1)) ,ftx);
subplot(2,1,2); plot(Lhit(:,2),exp(Lhit(:,1)),'k-','LineWidth',2)
xlabel('z','FontName','Arial','FontSize',13,'FontWeight','Bold')
%before finally computing the probability over differences of z-transformed rates:
%but note that here it is important to first re-linearize abscissa values, or nonlinearities from the previous transform will build up and create problems
xhit=linspace(Lhit(100,2),Lhit(end-100,2),1001)';
xfa=linspace(Lfa(100,2),Lfa(end-100,2),1001)';
phit=interp1(Lhit(100:end-100,2),Lhit(100:end-100,1),xhit,'pchip'); phit=exp(phit-max(phit));
pfa=interp1(Lfa(100:end-100,2),Lfa(100:end-100,1),xfa,'pchip'); pfa=exp(pfa-max(pfa));
[pS, pD, sSD]=SumDiffFig([pfa xfa],[phit xhit],[45 46],0,0); %noScale; Continuous
figure(Fnum+1); clf
plot(pD(:,2),pD(:,1)/max(pD(:,1)),'k.')
axis([-3 3 0 1])
xlabel('d''','FontName','Arial','FontSize',13,'FontWeight','Bold')
ylabel('p','FontName','Arial','FontSize',13,'FontWeight','Bold')