# SIGLEVEL.MAC # # Illustrates significance level for hypothesis tests for one population mean. # # Macro is for MINITAB for Windows, release 10 and above # Written by: Neil A. Weiss # Date: 06/19/96 # Revision history: # 09/14/96: Changed the MCOLUMN "NUMBER" to "CNT" because Release 11 # objects to "NUMBER" as a column name. MACRO SIGLEVEL MCOLUMN C D NUM ALPHA XBAR S T P CNT REJECT PERCENT MCOLUMN TH1 TH2 TH3 TH4 TH5 TEXT1 TEXT2 MCONSTANT mu sigma n m df a alt k l i obspct BRIEF 2 # DEFAULT NOTE NOTE This macro illustrates significance level (probability of rejecting a NOTE true null hypothesis) for hypothesis tests for one population mean NOTE by comparing a theoretical significance level to an observed percentage NOTE of hypothesis tests in which a true null hypothesis is rejected. NOTE NOTE Press "R" and to continue. BRIEF 0 PAUSE BRIEF 2 NOTE NOTE You will be asked to enter a mean and standard deviation for the NOTE population, a sample size, and a significance level; these are your NOTE choice. You will also be asked how many hypothesis tests you want NOTE conducted. NOTE NOTE Press "R" and to continue. BRIEF 0 PAUSE BRIEF 2 NOTE NOTE The computer will simulate taking a sample of the size you specified NOTE from a (normally distributed) population having the mean and NOTE standard deviation you specified. It will then perform a t-test NOTE (at the significance level you specified) with the null-hypothesis mean NOTE being the true mean. Then it will check whether the null hypothesis is NOTE rejected. This entire procedure will be repeated the number of times you NOTE specified. NOTE NOTE Press "R" and to continue. BRIEF 0 PAUSE BRIEF 2 NOTE NOTE Finally, the computer will determine the percentage of the hypothesis NOTE tests in which the null hypothesis is rejected. This observed NOTE percentage should, of course, be roughly equal to the specified NOTE significance level. The larger the number of hypothesis tests you had NOTE the computer conduct, the closer the observed percentage should tend to NOTE be to the specified significance level. NOTE NOTE Press "R" and to begin. BRIEF 0 PAUSE BRIEF 2 NOTE NOTE Enter the mean of the population. SET C; FILE 'TERMINAL'; NOBS=1. COPY C mu NOTE NOTE Enter the standard deviation of the population. SET C; FILE 'TERMINAL'; NOBS=1. COPY C sigma NOTE NOTE Enter the sample size. SET C; FILE 'TERMINAL'; NOBS=1. COPY C n NOTE NOTE Enter the significance level, as a decimal. SET C; FILE 'TERMINAL'; NOBS=1. COPY C a NOTE NOTE Enter 0, 1, or -1, respectively, for a two-tailed, right-tailed, or NOTE left-tailed test. SET C; FILE 'TERMINAL'; NOBS=1. COPY C alt NOTE NOTE How many hypothesis tests do you want conducted? SET C; FILE 'TERMINAL'; NOBS=1. COPY C m BRIEF 0 READ NUM ALPHA; FORMAT (F1,X,A3). 1 yes 0 no END LET df=n-1 DO i=1:m RANDOM n C; NORMAL mu sigma. LET XBAR(i)=MEAN(C) LET S(i)=STDEV(C) LET T(i)=(MEAN(C)-mu)/(STDEV(C)/SQRT(n)) LET l=T(i) CDF l k; T df. LET P(i)=k IF alt=0 LET k=1-P(i) IF ka LET CNT(i)=0 ELSE LET CNT(i)=1 ENDIF ENDDO LET obspct=SUM(CNT)/m*100 COPY obspct C LET D=100*a CONVERT NUM ALPHA CNT REJECT READ TEXT1; FORMAT (A54). The observed percentage of rejected null hypotheses is END READ TEXT2; FORMAT (A51). Compare this to the specified significance level of END READ PERCENT; FORMAT (A2). %. END NTOA XBAR XBAR NTOA S S NTOA T T NTOA P P READ TH1 TH2 TH3 TH4 TH5; FORMAT (A11,X,A12,X,A11,X,A7,X,A12). Sample mean Sample stdev t-statistic P-value Reject null? --------------------------------------------------------- END STACK (TH1 TH2 TH3 TH4 TH5) (XBAR S T P REJECT) (TH1 TH2 TH3 TH4 TH5) BRIEF 2 PRINT TH1 TH2 TH3 TH4 TH5; FORMAT (A11,3X,A12,3X,A11,3X,A7,3X,A12). PRINT TEXT1 C PERCENT TEXT2 D PERCENT; FORMAT (A54,F5.1,A2//A51,F3,A2). ENDMACRO