macro normplot r; Label ID. #Copyright © 1 December 2000 Mathews and Malnar #All rights reserved #Rev. for Minitab V13.2 (Bek) #Rev. for Minitab 14 (6/7/04, PGM) #Rev. 1/31/05 (PGM): Changed macro name back to normplot. #This macro is used to construct a normal probability plot. #The macro input is one column containing the response and an #optional label column used in the graphing routine. The #macro calculates the mid band percentiles and the corresponding z #values. The probability plot shows the responses verses their z #values. A best fit line passing through the origin is superimposed #on the data. Label is a column of IDs for points to appear next #to each point. #This macro may be altered to show the calculating columns, #otherwise there is only graphical output. #Mathews Malnar & Bailey, Inc. #217 Third Street, Fairport Harbor, OH 44077 #(440)350-0911 #pmathews@apk.net #Example call: # mtb> %plotnorm c1; # Label c2. where, c1 is the column of responses # and c2 has a list of labels. mcolumn r ID sortedr sortID index percent z labels refperc sum abssum xy mconstant NResp slope xlowcoor ylowcoor xcoordin ycoordin zlowcoor zcoordin If Label sort r ID sortedr sortID Copy sortedr sortID sortedr sortID; Omit sortedr = '*'. #searches and drops missing values Else sort r sortedr Copy sortedr sortedr; Omit sortedr = '*'. Endif. #Label sorting routine let NResp=N(sortedr) #counts non-missing values set index #index for postion equation 1:NResp end. # let percent=(index-0.5)/(NResp) #finds percent position let percent=(index-3/8)/(NResp+1/4) #this is more accurate invcdf percent z #z scale let xy=sortedr*z let slope=((sum(xy)-(NResp*mean(sortedr)*mean(z)))/(SSQ(sortedr)-(NResp*mean(sortedr)*mean(sortedr)))) set labels #reference lines 0.01 0.10 0.50 0.90 0.99 end. invcdf labels refperc let refperc=ROUND(refperc,3) Text labels labels; Maxwidth 80. let xlowcoor=(1-0.5)/(NResp) invcdf xlowcoor zlowcoor let ylowcoor=zlowcoor/slope+mean(sortedr) let xcoordin=(index(NResp)-0.5)/(NResp) #z for last point invcdf xcoordin zcoordin let ycoordin=zcoordin/slope+mean(sortedr) #predicted response for last point at end of line if Label #Plots data with IDs Plot sortedr*z; Line zlowcoor ylowcoor zcoordin ycoordin; Color 2; Title "Normal Probability Plot"; Footnote "Mathews Malnar and Bailey, Inc., November 2000"; TSize 0.6; Data 0.1 0.9 0.1 0.85; AxLabel 1 "Normal Probability"; TSize 0.8; AxLabel 2 "Response"; TSize 0.8; Grid 2; Scale 1; Model 1; Tick refperc; Labels labels; Reference 1 refperc; side 2; Labels labels; Symbol; Type 1; Size 0.5; DatLab sortID; TSize .6; Offset 0.0 0.0125; Placement -1 1. else Plot sortedr*z; #Plots data without IDs Symbol; Type 1; Size 0.5; Line zlowcoor ylowcoor zcoordin ycoordin; Color 2; Title "Normal Probability Plot"; Footnote "Mathews Malnar and Bailey, Inc., November 2000"; TSize 0.6; Data 0.1 0.9 0.1 0.85; AxLabel 1 "Normal Probability"; TSize 0.8; AxLabel 2 "Response"; TSize 0.8; Grid 2; Scale 1; Model 1; Tick refperc; Labels labels; Reference 1 refperc; side 2; Labels labels. endif #Label plotting routine endmacro.