* --------- SHAZAM procedure for computing the power of a test ------- PROC PFUNC * Test H0: mean = 5 versus H1: mean not equal to 5 * Input requirements * SDEV: standard deviation * NOBS: number of observations * ZVAL: the critical value GEN1 SD=[SDEV] GEN1 N=[NOBS] GEN1 ZCRIT=[ZVAL] * compute the upper and lower bounds of the acceptance region GEN1 STDERR=SD/SQRT(N) GEN1 XLOW=5-ZCRIT*STDERR GEN1 XUP=5+ZCRIT*STDERR * Try 20 different values of the population mean SAMPLE 1 20 GENR MEAN=5+TIME(-10)/100 * Find the probability of a Type II error GENR ZLOW=(XLOW-MEAN)/STDERR GENR ZUP=(XUP-MEAN)/STDERR GENR BETA=NCDF(ZUP)-NCDF(ZLOW) * Compute the power GENR POWER=1-BETA PROCEND * ------------------------------------------------------------------------- SAMPLE 1 20 * sd = 0.1; n=16 and alpha = 0.05 SDEV: 0.1 NOBS: 16 ZVAL: 1.96 EXEC PFUNC GENR POWER1=POWER * Increase the sample size * sd = 0.1; n=100 and alpha = 0.05 SDEV: 0.1 NOBS: 100 ZVAL: 1.96 EXEC PFUNC GENR POWER2=POWER * Decrease the significance level * sd = 0.1; n=16 and alpha = 0.01 SDEV: 0.1 NOBS: 16 ZVAL: 2.576 EXEC PFUNC GENR POWER3=POWER * Increase the variance * sd = 0.2; n=16 and alpha = 0.05 SDEV: 0.2 NOBS: 16 ZVAL: 1.96 EXEC PFUNC GENR POWER4=POWER * Print the results PRINT MEAN POWER1-POWER4 STOP