Random Signals for Engineers using MATLAB and Mathcad Copyright 1999 Springer Verlag NY Example 7.5 Theoretical Receiver Operating Curve In the example we will derive and plot the ROC. After we plot the ROC we will show that the slope of the ROC is equal to the threshold. The threshold setting using the normalized variable is given in Equation 7.4-34. We repeat this value in the example. ln0 d y 1 i my T d 2 n n n m where the parameter d is defined as d We must now compute the PD and PF in terms of the threshold as a function of T. The expression for PD is in terms of the my is given by the integral. For Hypothesis 0 the expected value of m y is zero and the density function is gaussian. This is true because my is the sum of scaled gaussian variables and is therefore gaussian. the variance of my can be calculated by summing the square of all the terms in m y of E m y2 1 n 2 n E yi2 2 1 n 2 n 2 1 2 the integral of PD becomes Pa PF or the PF is 1 2 e x2 2 dz 1 cnorm( T ) T ln0 d PF (d ) 1 cnorm d 2 In order to calculate PD we must determine the mean of my for hypothesis 1. Performing the summation we find E my E yi 1 1 m m n d n n n n The variance of my under hypothesis 1 is still = 1 as before. Therefore the integral for PD becomes PF Or PD becomes 1 2 e z d 2 2 dz 1 cnorm( T d ) T ln( 0 ) d PD(d ) 1 cnorm d 2 and express PD and PF and the ROC can be plotted parametrically for different values of d and as a function of the threshold value or lam=0.001:0.1:30; PD02=1-cnorm(log(lam)/0.2-0.2/2,0,1); PD10=1-cnorm(log(lam)/1.0-1.0/2,0,1); PD20=1-cnorm(log(lam)/2.0-2.0/2,0,1); PD30=1-cnorm(log(lam)/3.0-3.0/2,0,1); PF02=1-cnorm(log(lam)/0.2+0.2/2,0,1); PF10=1-cnorm(log(lam)/1.0+1.0/2,0,1); PF20=1-cnorm(log(lam)/2.0+2.0/2,0,1); PF30=1-cnorm(log(lam)/3.0+3.0/2,0,1); plot(PF02,PD02,PF10,PD10,PF20,PD20,PF30,PD30) xlabel 'PF - Prob. False Alarm' ylabel 'Pd - Prob. Detection' 1 0.9 0.8 Pd - Prob. Detection 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 PF - Prob. False Alarm 0.8 0.9 1 We notice as the parameter separation increases the ROC approaches the ideal ROC which gives PD -> 1 as PF -> 0. We would like to compute the slope of a ROC where the abscissa is PF and the ordinate is PD. Both PF(h) and PD(h) are a function of the threshold . Writing the integrals for PF and PD in terms of the conditional density functions we have syms u eta PDA=maple('int','p1(u),u=eta..inf') PFA=maple('int','p0(u),u=eta..inf') PDA = int(p1(u),u = eta .. inf) PFA = int(p0(u),u = eta .. inf) Differentiating using Matlab we have diff(PDA,eta) diff(PFA,eta) ans = -p1(eta) ans = -p0(eta) The threshold, , by the Likelihood ratio test is chosen when the following equation in y is solve can calling the solution, y, the threshold p1 y p0 y Select a and a d=2 lam(13) ans = 1.2010 Evaluate the values and compute the slopes by taking the numerical difference divided by delta = 0.1 to approximate the derivative. PF20(13) , PD20(13) ans = 0.1375 ans = 0.8182 The slope approximation dPF=diff(PF20); dPD=diff(PD20); dPF(12)/.1 , dPD(12)/.1 ans = -0.0978 ans = -0.1125 Take the ratio of the slope to find the Slope of the ROC dPD(12)/dPF(12) ans = 1.1499 The value of the ratio is approximately equal to 0 = 1.2. The difference in the values is due to the crude numerical approximation of the derivative.