macro occurve DxA nn p1 p2beta p2 PDxA; mfg alpha; cons beta. #Intended for use after twosamplepsize.mac. #This macro generates the P(dx<=DxA;n,p1,p2) vs. p2 #for OC curves. The user must create the source #column p2 and the corresponding PDxA are output. #p1 and p2beta are the fractions defective corresponding #to alpha and beta and are also shown on the plot. #Example call: # mtb> %occurve 2 40 0.01 0.10 c1 c2 #Copyright Mathews and Malnar, April 2001 mconstant DxA nn p1 onep2 onePdx onePDxA i rows mconstant alpha notalpha beta p2beta mcolumn p2 PDxA default alpha=0.05 default beta=0.10 let notalpha=1-alpha brief 0 count p2 rows brief 1 if rows=0 note note You must provide the column of p1 values! note Please create the column and try again. note else note note The macro is running. This may take a while... note do i=1:rows let onep2=p2(i) if onep2=0 let onePDxA=1 else call Ponedx nn DxA p1 onep2 onePDxA endif let PDxA(i)=onePDxA enddo Plot PDxA*p2; Connect; Minimum 1 0; Minimum 2 0; Axis 1; Label "p"; Axis 2; Label "Pa"; Reference 2 beta notalpha 1.0; Type 3; Reference 2 0; Size 2; Reference 1 0; Size 2; Reference 1 p1 p2beta; Type 3; footnote "Mathews and Malnar, April 2001". endif endmacro ##################################################### macro Ponedx nn DxA p1 p2 PDxA #This macro finds P(dx<=DxA;n,p1,p2) #Example call: # mtb> %Pdx 40 2 0.01 0.10 k1 mconstant nn dx DxA p1 p2 Px1 PDxA bottom mcolumn x1 x2 bxnp1 bxnp2 bxnp brief 0 let bottom=-nn let PDxA=0 set x1 0:nn end do dx=bottom:DxA erase bxnp1 bxnp2 pdf x1 bxnp1; binomial nn p1. let x2=x1+dx pdf x2 bxnp2; binomial nn p2. let bxnp=bxnp1*bxnp2 sum bxnp Px1 let PDxA=PDxA+Px1 enddo brief 1 endmacro