macro plotnorm r; Label ID. #Copyright © 1 December 2000 Mathews and Malnar #All rights reserved #Rev. 1.0 for Minitab V13.2 (Bek) #This macro is used to construct a probability plot for normal #data. 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 #217 Third Street, Fairport Harbor, OH 44077 #(440)350-0911 #pmathews@apk.net #This macro should be copied into the Minitab source macros directory for #immediate use, otherwise a change directory (cd) command will be needed. #Example call: # mtb> %plotnorm c1; # Label c2. where, c1 is the column of responses # and c2 has a list of labels. #Copy the following line, minus the leading #, to the command line: #%plotnorm c1; # Label c2. mcolumn r ID sortedr sortID index percent z labels refperc sum abssum mcolumn 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 and Malnar, November 2000"; TSize 0.7; Data 0.1 0.9 0.1 0.9; ScFrame; ScAnnotation; Axis 1; Label "Normal Probability"; TSize 0.8; Axis 2; Label "Response"; TSize 0.8; Tick 1 refperc; Labels labels; Tick 2; Reference 1 refperc; side 1; Labels labels; Symbol; Type 1; Size 0.5; Label 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 and Malnar, November 2000"; TSize 0.7; Data 0.1 0.9 0.1 0.9; ScFrame; ScAnnotation; Axis 1; Label "Normal Probability"; TSize 0.8; Axis 2; Label "Response"; TSize 0.8; Tick 1 refperc; Labels labels; Tick 2; Reference 1 refperc; side 1; Labels labels. endif #Label plotting routine endmacro.