macro halfnorm r; Label ID. #Copyright © 30 November 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 #half-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. #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> %halfnorm c1; # subc> label c2. #where c1 is the column of responses and c2 has an optional list of data labels. #Copy the following line, minus the leading #, to the command line: #%halfnorm c1; # Label c2. mcolumn r ID sortedr sortID index percent z labels refperc sum abssum mconstant NResp slope xcoordin ycoordin let sum=sum(r) let abssum=sum(abs(r)) If sum=abssum 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=(NResp+index-0.5)/(2*NResp) #finds percent position invcdf percent z #z scale let slope=mean(sortedr)/mean(z) #slope of reference line #reference lines set labels 0.10 0.50 0.90 0.99 end. let refperc=0.5*(labels+1) #find corresponding percentile on right side invcdf refperc refperc #these are their z values let refperc=ROUND(refperc,3) Text labels labels; Maxwidth 80. let xcoordin=(NResp+index(NREsp)-0.5)/(2*NResp) #z for last point if xcoordin < 2.576 let xcoordin=2.576 #set zeta to 99th percent when there are few points endif let ycoordin=xcoordin*slope #predicted response for last point at end of line if Label #Plots data with IDs Plot sortedr*z; Minimum 1 0; Line 0 0 xcoordin ycoordin; Color 2; Title "Half-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 "Probability"; TSize 0.9; Axis 2; Label "Response"; TSize 0.9; 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 Minimum 1 0; Symbol; Type 1; Size 0.5; Line 0 0 xcoordin ycoordin; Color 2; Title "Half-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 "Probability"; Axis 2; Label "Response"; TSize 0.9; Tick 1 refperc; Labels labels; Tick 2; Reference 1 refperc; side 1; Labels labels. endif. #Label plotting routine Else #when one or more data values are negative Note Note Circular normal data must all be postive. Note Please check data before running macro again. endif. #ends main if statement endmacro.