macro defectivesOC n c p Pa #This macro calculates the OC curve for the single sampling #plan for defectives given by Pa=b(c;n,p) where n and c are #specified by the user. The macro determines the appropriate #bounds for the OC curve plot. #Example call: #%defectivesOC 300 0 c1 c2 #This macro has known defects and can generate erroneous data. #The user is responsible for checking all work and Mathews and #Malnar take no responsibility for the results from or misuse of this #macro. #by Mathews and Malnar for Minitab V13 #217 Third Street, Fairport Harbor, OH 44077 #440-350-0911 #pmathews@apk.net #Copyright December 2001 All Rights Reserved mcolumn p Pa mconstant n c i npvals answ thisp pmax dp dtick name p 'p' name Pa 'Pa' let pmax=6/n*sqrt(c+1) #good upper bound for plotting let dp=pmax/100 #increment for points along OC curve set p 0:pmax/dp end let npvals=101 let Pa(1)=1 do i=2:npvals let thisp=p(i) cdf c answ; #find Pa for this c, n, and p binomial n thisp. let Pa(i)=answ enddo call finddtick pmax dtick #determine how far apart the ticks will be plot Pa*p; #plot the OC curve connect; tick 1 0:pmax/dtick; tick 2 0:1/0.1; reference 1 0; size 3; reference 2 0; size 3; grid 1; grid 2; axis 1; label "Fraction Defective (p)"; axis 2; label "Pa"; title "Operating Characteristic Curve"; footnote "Mathews and Malnar, December 2001"; size 0.8. endmacro macro finddtick pmax dtick #by Mathews and Malner for use with macro defectivesOC.mac #Copyright December 2001 All Rights Reserved mcolumn tryd mconstant pmax dtick i thistry #these are good increment choices for the p axis set tryd (0.0001 0.0002 0.0005 0.001 0.002 0.005 0.01 0.02 0.05 0.10) end let i=0 let thistry=100 while thistry>8 #too many ticks let i=i+1 let thistry=pmax/tryd(i) endwhile let dtick=tryd(i) #the magic tick spacing endmacro