macro threenorms r; Label ID. #Copyright © 4 December 2000 Mathews and Malnar All Rights Reserved #Rev. 1.0 for Minitab V13.2 (Bek) #Rev. 1.1 (PGM) Changed half normal probability axis and labels and method #for determining max and min bounds for Response axis. #This macro creates a single page containing three graphs: a #circular normal, half normal, and a normal probability plot of a #single column of data. The intended purpose is for the user to #easily identify the type of data by viewing the graphs and determining #which graph best fits the data. If some data values are negative the program #automatically calls the MMB normal plot macro and displays a normal plot #of the data. The probability plots show the responses (y-axis) #verses their z or zeta (x-axis) values and reference lines are drawn #at some common percentiles. 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 #MM&B offers a 20 page document describing the circular normal distribution #and procedures for handling circular normal data. Training is also available. #Call or email for details. #This macro sould be copied into the Minitab source macros directory for #immediate use, otherwise a change directory (cd) command will be needed. #Example call: # mtb> %threenorms c1 #where, c1 is the column of responses. # subc> label c2. #where, c2 is a column of labels #Copy the following line, minus the leading #, to the command line: #%threenorms c1; #label c2. mcolumn r ID sortedr sortID index circper Zeta mcolumn halfper halfz normper normz labels hnlabels circref mcolumn halfref normref sum abssum xy mconstant NResp circslo halfslo normslo circxcoo circycoo mconstant halfxcoo halfycoo normxcoo normycoo xlowcoor ylowcoor mconstant zlowcoor zcoordin min max let sum=sum(r) let abssum=sum(abs(r)) If sum=abssum #tests for positive data values If Label #drops missing values sort r ID sortedr sortID Copy sortedr sortID sortedr sortID; Omit sortedr = '*'. Else sort r sortedr Copy sortedr sortedr; Omit sortedr = '*'. Endif. #Label sorting routine let NResp=N(sortedr) #creates index numbers for percent calc. set index 1:NResp end. let min=min(sortedr)-0.05*(max(sortedr)-min(sortedr)) #min and max for graph let max=max(sortedr)+0.05*(max(sortedr)-min(sortedr)) set labels #reference lines 0.01 0.10 0.50 0.90 0.99 end. ############################ Circular Normal Calculations let circper=(index-0.5)/NResp let Zeta=SQRT(-2*loge(1-circper)) let circslo=mean(sortedr)/mean(Zeta) #slope of line through circular normal data let circref=SQRT(-2*loge(1-labels)) let circref=ROUND(circref,3) let circxcoo=SQRT(-2*loge(1-circper(Nresp))) #zeta for last point if circxcoo < 3.035 let circxcoo=3.035 #set zeta to 99th percentile when there are few points endif let circycoo=circxcoo*circslo #predicted response for last point at end of line ######################### Half Normal Calculations let halfper=(NResp+index-0.5)/(2*NResp) invcdf halfper halfz let halfslo=mean(sortedr)/mean(halfz) set hnlabels #reference lines 0.10 0.50 0.90 0.99 end. let halfref=0.5*(hnlabels+1) invcdf halfref halfref let halfref=Round(halfref,3) let halfxcoo=(NResp+index(NResp)-0.5)/(2*NResp) #z for last point if halfxcoo < 2.575 let halfxcoo=2.575 #set zeta to 99th percent when there are few points endif let halfycoo=halfxcoo*halfslo #predicted response for last point at end of line ######################## Normal Plot Calculations # let normper=(index-0.5)/(NResp) let normper=(index-3/8)/(NResp+1/4) #this is more accurate invcdf normper normz let xy=sortedr*normz let normslo=((sum(xy)-(NResp*mean(sortedr)*mean(normz)))/(SSQ(sortedr)-(NResp*mean(sortedr)*mean(sortedr)))) invcdf labels normref let normref=Round(normref,3) let xlowcoor=(1-3/8)/(NResp+1/4) invcdf xlowcoor zlowcoor let ylowcoor=zlowcoor/normslo+mean(sortedr) let normxcoo=(index(NResp)-3/8)/(NResp+1/4) #z for last point invcdf normxcoo zcoordin let normycoo=zcoordin/normslo+mean(sortedr) #predicted response for last point at end of line ################################### Text labels labels; #turns label values to text Maxwidth 80. Text hnlabels hnlabels; #turns label values to text Maxwidth 80. ################################## Plotting routine with labels If Label Layout; Aspect 8.5 11; Footnote "Mathews and Malnar, December 2000"; TSize 0.5. Plot sortedr*Zeta; #Circular Normal plot with ID Line 0 0 circxcoo circycoo; Color 2; Title "Circular Normal Probability Plot"; TSize 0.7; Figure 0.10 0.9 0.05 0.35; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; TSize 0.9; Axis 2; Label "Response"; TSize 0.9; Tick 1 circref; Labels labels; Tick 2; Reference 1 circref; Side 1; Labels labels; Symbol; Type 1; Size 0.5; Label sortID; TSize .6; Offset 0.0 0.0125; Placement -1 1. Plot sortedr*halfz; #Half normal plot with IDs Minimum 1 0; Line 0 0 halfxcoo halfycoo; Color 2; Title "Half-Normal Probability Plot"; TSize 0.7; Figure 0.1 0.9 0.35 0.65; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; TSize 0.9; Axis 2; Label "Response"; TSize 0.9; Tick 1 halfref; Labels hnlabels; Tick 2; Reference 1 halfref; side 1; Labels hnlabels; Symbol; Type 1; Size 0.5; Label sortID; TSize .6; Offset 0.0 0.0125; Placement -1 1. Plot sortedr*normz; #Normal plot with ID Line zlowcoor ylowcoor zcoordin normycoo; Color 2; Title "Normal Probability Plot"; TSize 0.7; Figure 0.1 0.9 0.65 0.95; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; TSize 0.9; Axis 2; Label "Response"; TSize 0.9; Tick 1 normref; Labels labels; Tick 2; Reference 1 normref; side 1; Labels labels; Symbol; Type 1; Size 0.5; Label sortID; TSize .6; Offset 0.0 0.0125; Placement -1 1. Endlayout. ######################### Plotting routine without labels Else Layout; Aspect 8.5 11; Footnote "Mathews and Malnar, December 2000"; TSize 0.5. Plot sortedr*Zeta; #Circular normal plot without ID Symbol; Type 1; Size 0.5; Line 0 0 circxcoo circycoo; Color 2; Title "Circular Normal Probability Plot"; TSize 0.7; Figure 0.1 0.90 0.05 0.35; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; TSize 0.9; Axis 2; Label "Response"; TSize 0.9; Tick 1 circref; Labels labels; Tick 2; Reference 1 circref; Side 1; Labels labels. Plot sortedr*halfz; #half normal plot without IDs Minimum 1 0; Symbol; Type 1; Size 0.5; Line 0 0 halfxcoo halfycoo; Color 2; Title "Half-Normal Probability Plot"; TSize 0.7; Figure 0.10 0.90 0.35 0.65; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; Axis 2; Label "Response"; TSize 0.9; Tick 1 halfref; Labels hnlabels; Tick 2; Reference 1 halfref; side 1; Labels hnlabels. Plot sortedr*normz; #Normal Plot without IDs Symbol; Type 1; Size 0.5; Line zlowcoor ylowcoor zcoordin normycoo; Color 2; Title "Normal Probability Plot"; TSize 0.7; Figure 0.10 0.90 0.65 0.95; Data 0.1 0.9 0.1 0.9; Minimum 2 min; Maximum 2 max; ScFrame; ScAnnotation; Axis 1; Label "Probability"; Axis 2; Label "Response"; TSize 0.9; Tick 1 normref; Labels labels; Tick 2; Reference 1 normref; side 1; Labels labels. Endlayout. Endif #(plotting with or without labels) ######################Plotting routines for negative data Else #when one or more data values are negative If Label %plotnorm r; #Calls MMB's norm plotting routine Label ID. Else %plotnorm r Endif. Note #comment to user Note There are negative data values. Note The data are most likely normal. Note The normal plot of the data has been provided. endif. #ends main if statement (negative data) endmacro.