***************************************************************************** * CHAPTER 16 - STATISTICS FOR BUSINESS & ECONOMICS, 4th Ed., by Paul Newbold* ***************************************************************************** * * Control Charts For Means And Standard Deviations on Page 645. * * In this example, the variable SAMPLE NUMBER is not required and thus, it * is not included in Table16.1. The BYVAR option is specified on the READ * command so each row of observations read will represent a variable. In * this case, the data will be read in variable by variable rather than by * observation by observation when the BYVAR option is not specified. * SAMPLE 1 5 READ X1-X20 / BYVAR LIST 297 296 297 303 298 301 301 300 304 297 297 306 296 302 304 296 302 299 298 309 305 304 293 309 293 298 294 303 306 305 297 304 299 298 306 292 292 307 295 300 295 297 307 304 306 296 297 309 297 305 299 301 290 298 297 303 307 296 298 294 301 292 313 302 307 299 298 300 301 295 299 299 306 303 298 301 303 297 298 304 300 296 301 300 304 295 293 300 299 289 298 298 306 297 295 296 303 300 304 299 * * The STAT command automatically prints out the mean and standard deviation * of each variable specified. * * The SAMPLE command is used to change the sample range from 1 5 to 1 20 * as the mean and standard deviations will be saved in a vector called * XBAR and S. If the sample range is not changed the vector XBAR and S * will only store the first 5 mean and standard deviations in the STAT * command. The STAT output of X1 to X20 prints out the last 2 columns * of Table 16.1 on page 646. The mean and standard deviation of the * variables X1 to X20 will be used in plotting Figure 16.1. * SAMPLE 1 20 STAT X1-X20 / MEAN=XBAR STDEV=S * *---------------------------------------------------------------------------- * Control Charts for Means on page 648. * * The SAMPLE command is used to change the range to 1 9 to replicate the * Table 16.2. * SAMPLE 1 9 * * The TIME function on the GENR command generates a time index beginning * at 2. * GENR N=TIME(1) * * The EXP function calculates the exponential, the LGAM function calculates * the log gamma function, the LOG funtion calculates the natural log and * the SQRT function calculates the square root. * GENR C4=EXP(-LGAM((N-1)/2)+LGAM(N/2)-0.5*LOG((N-1)/2)) GENR A3=3/(C4*SQRT(N)) GENR B3=1-(3/C4)*SQRT(1-C4*C4) * * The IF command is a conditional GENR command. If the expression in the * parentheses is true or positive then the remainder of the IF command is * executed. * IF(B3.LT.0) B3=0 GENR B4=1+(3/C4)*SQRT(1-C4*C4) * * Print Table 16.2 on page 648. * PRINT N C4 A3 B3 B4 * *---------------------------------------------------------------------------- * The SAMPLE command is used to change the sample range to 1 20 from 1 9 * from the previous example. The GENR command is used to generate a time * index defined as TIME beginning at 1. The GEN1 command is used to generate * the constants X-doublebar, s-bar and A3 listed in the middle of page 650. * SAMPLE 1 20 GENR TIME=TIME(0) GEN1 XDBAR=299.9 GEN1 SBAR=4.48 GEN1 A3=1.43 * * The GEN1 command is used to Central Line defined as CLX, the Lower Control * Limit defined as LCLX and the Upper Control Limit defined as UCLX for the * X-chart. * GEN1 CLX=XDBAR GEN1 LCLX=XDBAR-(A3*SBAR) GEN1 UCLX=XDBAR+(A3*SBAR) PRINT CLX LCLX UCLX * * The PLOT command is used to plot the X-chart for timing signal data in * Figure 16.1 on page 651. The YMIN= and YMAX= options are specified to * set the range of the Y-axis equal to the Lower Control Limit, LCLX, and * the Upper Control Limit, UCLX as previously calculated with the GEN1 * command. The NOPRETTY option must be specified when the YMIN= and YMAX= * options are used otherwise, SHAZAM will set the range of the Y-axis based * on the data. * PLOT XBAR TIME / NOPRETTY YMIN=LCLX YMAX=UCLX * * The GEN1 command is used to generate the constants s-bar, B3 and B4 * listed near the bottom of page 651. Recall s-bar was previously defined * as SBAR. * GEN1 B3=0 GEN1 B4=2.09 * * The Central Line of the s-Chart is defined as LCS, the Lower Control Limit * is defined as LCLS and the Upper Control Limit is defined as UCLS. * GEN1 CLS=SBAR GEN1 LCLS=B3*SBAR GEN1 UCLS=B4*SBAR PRINT CLS LCLS UCLS * * The PLOT command is used to plot s-Chart for the timing signal data in * Figure 16.2 on page 652. The YMIN= and YMAX= options are specified to set * the range of the Y-axis equal to the Lower Control Limit, LCLS, and * the Upper Control Limit, UCLS as previously calculated with the GEN1 * command. The NOPRETTY option must be specified when the YMIN= and YMAX= * options are used otherwise, SHAZAM will set the range of the Y-axis based * on the data. * PLOT S TIME / NOPRETTY YMIN=LCLS YMAX=UCLS * *----------------------------------------------------------------------------- * Measures of Process Capability on page 657. * * Recall in the previous example, X-doublebar was defined as XDBAR with the * GEN1 command. Now the GEN1 command is used to generate the constants * the new constants required for the calculation of the Capability Index * and the Cpk Index. * GEN1 SIGMAHAT=4.77 GEN1 L=280 GEN1 U=320 * * The Capability Index is defined as CP and the Cpk Index is defined as * CPK1 and CPK2 with the GEN1 command. * GEN1 CP=(U-L)/(6*SIGMAHAT) GEN1 CPK1=(U-XDBAR)/(3*SIGMAHAT) GEN1 CPK2=(XDBAR-L)/(3*SIGMAHAT) PRINT CP CPK1 CPK2 * *---------------------------------------------------------------------------- * Control Charts for Proportions on page 661. * * The SAMPLE command is not required as the previous SAMPLE command set the * range to 1 20. The sample range in Table 16.3 is also 1 20. The READ * command reads in the data for the Sample Number, SN, Number Nonconforming * items, NN and p-hat, PHAT. * READ SN NN PHAT / LIST 1 18 0.090 2 15 0.075 3 23 0.115 4 9 0.045 5 17 0.085 6 29 0.145 7 11 0.055 8 21 0.105 9 25 0.125 10 14 0.070 11 19 0.095 12 26 0.130 13 11 0.055 14 28 0.140 15 22 0.110 16 14 0.070 17 25 0.125 18 17 0.085 19 23 0.115 20 18 0.090 * * The STAT command is used to save the mean value of PHAT in the constant * PBAR. * STAT PHAT / MEAN=PBAR * * The GEN1 command is used to calculate the p-chart Central Line, CLP, * Lower Control Limit, LCLP and Upper Control Limit, UCLP. * GEN1 CLP=PBAR GEN1 N=200 GEN1 LCLP=PBAR-3*(SQRT((PBAR*(1-PBAR))/N)) GEN1 UCLP=PBAR+S*(SQRT((PBAR*(1-PBAR))/N)) PRINT CLP LCLP UCLP * * The PLOT command is used to plot p-chart for the sample proportion of * nonconforming items in Figure 16.4 on page 661. The YMIN= and YMAX= * options are specified to set the range of the Y-axis equal to the Lower * Control Limit, LCLP, and the Upper Control Limit, UCLP as previously * calculated with the GEN1 command. The NOPRETTY option must be specified * when the YMIN= and YMAX= options are used otherwise, SHAZAM will set the * range of the Y-axis based on the data. * PLOT PHAT TIME / NOPRETTY YMIN=LCLP YMAX=UCLP * *---------------------------------------------------------------------------- * Control Charts for Number of Occurrences on page 663. * * The SAMPLE command is not required as the previous SAMPLE command set the * range to 1 20. The sample range in Table 16.4 is also 1 20. The READ * command reads in the data for the Cloth Bolt, CB, and Number of * Imperfections, NI. * READ CB NI / LIST 1 8 2 8 3 6 4 8 5 9 6 5 7 7 8 2 9 3 10 10 11 7 12 6 13 8 14 2 15 1 16 7 17 9 18 11 19 9 20 6 * * The STAT command is used to save the mean of the Number of Imperfections * in the constant CBAR. * STAT NI / MEAN=CBAR * * The GEN1 command is used to generate the Central Line defined as CLC. * GEN1 CLC=CBAR * * The IF1 command is equivalent to using the SAMPLE 1 1 command and the * IF command. The IF command is a conditional GENR command. If the * expression in the parentheses is true or positive then the remainder * of the IF command is executed. In this example, the Lower Control Limit, * LCLC, is calculated based on the value of c-bar. The first IF1 command * determines if c-bar is less than or equal to 9. If this expression is * true then the remainder of the statement is executed. If the first IF1 * expression is not true then the second IF1 command is executed. * IF1(CBAR.LE.9) LCLC=0 IF1(CBAR.GT.9) LCLC=CBAR-(3*SQRT(CBAR)) * * The Upper Control Limit is defined as UCLC with the GEN1 command. * GEN1 UCLC=CBAR+(3*SQRT(CBAR)) PRINT CLC LCLC UCLC * * The PLOT command is used to plot c-Chart for the number of occurrences of * an event in Figure 16.5 on page 664. The YMIN= and YMAX= options are * specified to set the range of the Y-axis equal to the Lower Control Limit, * LCLC, and the Upper Control Limit, UCLC as previously calculated with the * GEN1 command. The NOPRETTY option must be specified when the YMIN= and * YMAX= options are used otherwise, SHAZAM will set the range of the Y-axis * based on the data. * PLOT NI TIME / NOPRETTY YMIN=LCLC YMAX=UCLC * DELETE / ALL * *---------------------------------------------------------------------------- * STOP