8
Appendix 14.1 Chi-Square Tests Using MINITAB Appendix 14.2 Chi-Square Tests Using Excel Appendix 14.3 Chi-Square Tests Using MegaStat Chapter 14 Appendix

bow83755_app14

Embed Size (px)

DESCRIPTION

needed

Citation preview

  • Appendix 14.1 Chi-Square Tests Using MINITAB

    Appendix 14.2 Chi-Square Tests Using Excel

    Appendix 14.3 Chi-Square Tests Using MegaStat

    Chapter 14Appendix

    bow83755_app14_001-008.qxd 9/6/08 10:02 PM Page 14A-1

  • 14A-2 Chapter 14 Chi-Square Tests

    APPENDIX 14.1 Chi-Square Tests Using MINITAB

    Performing the chi-square test for good-ness of fit in Figure 14.1 on page 527 (datafile: MicroWav.MTW):

    Enter the microwave oven data fromTables 14.1 and 14.2 on page 527observed frequencies in column C1with variable name Frequency andmarket shares (entered as decimalfractions) in column C2 with variablename MarketShr.

    Select Calc : Calculator. In the Calculator dialogue box, en-

    ter Expected in the Store result invariable box.

    In the Expression window, enter400*MarketShr and click OK tocompute the expected values.

    Select Calc : Calculator. Enter ChiSq in the Store result in

    variable box.

    In the Expression window, enter theformula (Frequency Expected)**2/Expected and click OK to computethe cell chi-square contributions.

    Select Calc : Column Statistics. In the Column Statistics dialogue

    box, select Sum.

    Enter ChiSq in the Input variablebox.

    Enter k1 in the Store result in boxand click OK to compute the chi-square statistic and to store it as theconstant k1.

    Select Calc : Probability Distributions :Chi-Square.

    In the Chi-Square Distribution dia-logue box, click on Cumulative prob-ability.

    Enter 3 in the Degrees of freedombox.

    Click the Input constant option andenter k1 in the corresponding box.

    Enter k2 in the Optional storagebox.

    Click OK in the Chi-SquareDistribution dialogue box.

    Select Calc : Calculator. In the Calculator dialogue box, en-

    ter PValue in the Store result invariable box.

    The instruction blocks in this section each begin bydescribing the entry of data in the MINITAB Data window.Alternatively, the data may be loaded directly from the datadisk included with the text. The appropriate data file name

    is given at the top of each instruction block. Please refer toAppendix 1.1 for further information about entering data,saving data, and printing results.

    bow83755_app14_001-008.qxd 9/6/08 10:02 PM Page 14A-2

  • Appendix 14.1 Chi-Square Tests Using MINITAB 14A-3

    In the Expression window, enter the formula1 k2, and click OK to compute the p valuerelated to the chi-square statistic.

    Select Data : Display Data. Enter PValue in the Columns, constants, and

    matrices to display window and click OK.

    Sum of ChiSq (=8.77857) is the chi-square statis-tic, and PValue (=0.0323845) is the corre-sponding p value.

    Constructing a contingency table and performingthe chi-square test for independence in Figure14.4(b) on page 538 (data file: Invest.MTW):

    In the Data window, enter the investmentcustomer satisfaction data from Table 14.9(page 537)fund type in column C1 withvariable name FundType and level of satis-faction in column C2 with variablename SatRating.

    The default ordering for the different levels ofeach categorical variable in the cross-tabulationtable will be alphabeticalthat is, Bond, Stock,and TaxDef for FundType and High, Low, andMed for SatRating. To change the ordering toHigh, Med, and Low for SatRating:

    Click on any cell in column C2 (SatRating). Select Editor : Column : Value order. In the Value Order for C2 (SatRating) dialogue

    box, click the User-specified order option.

    In the Define an order (one value per line)window, specify the order High, Med, Low.

    Click OK in the Value Order for C2(SatRating) dialogue box.

    Constructing the cross-tabulation table andperforming a chi-square test:

    Select Stat : Tables : Cross Tabulation and Chi-Square.

    In the Cross Tabulation and Chi-Squaredialogue box, enter FundType in theCategorical variables: For rows box.

    Enter SatRating in the Categoricalvariables: For columns box.

    Check the Display Counts, Row per-cents, and Column percents checkboxes.

    Click on the Chi-Square button. In the Cross TabulationChi-Square dia-

    logue box, check the Chi-Square analysisand Expected cell counts checkboxes.

    Click OK in the Cross TabulationChi-Square dialogue box.

    Click OK in the Cross Tabulation and Chi-Square dialogue box to obtain results inthe Session window.

    The chi-square statistic can also be calculatedfrom summary data by entering the cell countsfrom Figure 14.4(b) and selecting Chi-SquareTest (Table in Worksheet) from the Stat : Tablessubmenu.

    bow83755_app14_001-008.qxd 17/6/08 7:50 PM Page 14A-3

  • 14A-4 Chapter 14 Chi-Square Tests

    APPENDIX 14.2 Chi-Square Tests Using ExcelThe instruction blocks in this section each begin bydescribing the entry of data in an Excel spreadsheet.Alternatively, the data may be loaded directly from thedata disk included with the text. The appropriate data file

    name is given at the top of each instruction block. Pleaserefer to Appendix 1.2 for further information about enter-ing data, saving data, and printing results.

    Performing the chi-square goodness of fittest in Exercise 14.10 on page 535 (datafile: Invoice2.xls):

    In the first row of the spreadsheet,enter the following column headingsin orderPercent, Expected, Number,and ChiSqContribution.

    Beginning in cell A2, enter thePercentage of Invoices figures fromExercise 14.10 as decimal fractions incolumn A.

    Compute expected values. Enter theformula =500*A2 in cell B2 and pressEnter. Copy this formula through cellB6 by double-clicking the drag handlein the lower right corner of cell B2.

    Enter the Number of Invoices figures from Exercise 16.10 in cells C2 to C6.

    Compute cell chi-square contribu-tions. In cell D2, Enter the formula=(C2 B2)^2/B2 and press Enter. Copythis formula through cell D6 by double-clicking the drag handle inthe lower right corner of cell D2.

    Compute the chi-square statistic in cellD8. Use the mouse to select the rangeof cells D2 to D8 and click the button on the Excel toolbar.

    Click on an empty cell, say cell B24,and select the Insert Function but-ton on the Excel toolbar.

    In the Insert Function dialogue box,select Statistical from the Or selecta category menu, select CHIDISTfrom the Select a function menu,and click OK.

    In the CHIDIST Function Argumentsdialogue box, enter D8 in the X boxand 3 in the Deg_freedom box.

    Click OK in the CHIDIST FunctionArguments dialogue box to producethe p value related to the chi-squarestatistic in cell B24.

    fx

    a

    bow83755_app14_001-008.qxd 17/6/08 7:50 PM Page 14A-4

  • Appendix 14.2 Chi-Square Tests Using Excel 14A-5

    Constructing a contingency table and performing achi-square test for independence similar to Figure14.4(b) on page 538 (data file: Invest.xls):

    Enter the investment customer satisfaction datafrom Table 14.9 (page 537) with the fund typein column A (with label FundType) and the levelof satisfaction in column B (with label SRating).

    Building a contingency table (using the PivotTableand PivotChart Wizard):

    Click on cell A1. Select Data : PivotTable and PivotChart Report. In the PivotTable and PivotChart

    WizardStep 1 of 3 dialogue box, select theMicrosoft Office Excel list or database optionand then click Next.

    In the PivotTable and PivotChart WizardStep2 of 3 dialogue box, the range A1 to B101 shouldalready be selected (if not, select it). Click Next.

    Select the Existing worksheet option in thePivotTable and PivotChart WizardStep 3 of 3dialogue box, enter D1 in the box, and click Finish.

    Now use the mouse to drag items in the PivotTable Field List to the Pivot Table Report. DragFundType to the Drop Row Fields Here area,and drag SRating to the Drop Column FieldsHere area. Then also drag SRating to the DropData Items Here area.

    Computing a table of expected values:

    In cell E9, type the formula =$H3*E$6/$H$6 (bevery careful to include the $ in all the correctplaces) and press Enter (to obtain the expectedvalue 12 in cell E9).

    Click on cell E9 and use the mouse to point thecursor to the drag handle in the lower right cor-ner of the cell. The cursor will change to a blackcross. Using the black cross, drag the handleright to cell G9 and release the mouse button tofill cells F9 to G9. With E9 to G9 still selected, usethe black cross to drag the handle down to cellG11. Release the mouse button to fill cells E10to G11.

    To add marginal totals, select the range E9 to H12and click the button on the Excel toolbar.

    Computing the chi-square statistic:

    In cell E15, type the formula =(E3 E9)^2/E9and press Enter to obtain the cell contribution0.75 in E15.

    Click on cell E15 and (using the procedure de-scribed above) use the black cross cursor todrag the cell handle right to cell G15 and thendown to cell G17 (obtaining the cell contribu-tions in cells E15 to G17).

    To add marginal totals, select the range E15 to H18and click the button on the Excel toolbar.

    The chi-square statistic is in cell H18 (= 46.4375).a

    a

    bow83755_app14_001-008.qxd 19/6/08 3:30 PM Page 14A-5

  • 14A-6 Chapter 14 Chi-Square Tests

    Computing the p value for the chi-squaretest of independence:

    Click on an empty cell, say H25. Select the Insert Function button

    on the Excel toolbar.

    In the Insert Function dialogue box,select Statistical from the Or select a category menu, select CHIDISTfrom the Select a function menu, and click OK.

    In the CHIDIST Function Arguments di-alogue box, enter H18 in the X boxand 4 into the Deg_freedom box.

    Click OK in the CHIDIST Function Arguments dialogue box to producethe p value related to the chi-square sta-tistic in cell H25.

    fx

    APPENDIX 14.3 Chi-Square Tests Using MegaStatThe instructions in this section begin by describing the en-try of data in an Excel worksheet. Alternatively, the datamay be loaded directly from the data disk included withthe text. The appropriate data file name is given at the top

    of each instruction block. Please refer to Appendix 1.2 forfurther information about entering data and saving andprinting results in Excel and Appendix 1.3 for more infor-mation about using MegaStat.

    Constructing the contingency table and per-forming the chi-square test for independ-ence in Figure 14.4(a) on page 538 (data file:Invest.xls):

    Enter the investment satisfaction surveydata in Table 14.9 (page 537) with thetype of investment fund in column A(with label FundType) and the level ofcustomer satisfaction in column B (withlabel SRating).

    Type the labels BOND, STOCK, andTAXDEF in cells C3, C4, and C5. Theselabels will specify the row categories inthe contingency table.

    Type the labels HIGH, MED, and LOW incells D3, D4, and D5. These labels willspecify the column categories in thecontingency table.

    Select MegaStat : Chi-Square/Crosstab :Crosstabulation.

    In the Crosstabulation dialogue box,click in the Row variable data rangebox and use the AutoExpand feature toenter the range A1 to A101. This de-fines the variable FundType to be therow variable in the contingency table.

    Click in the Row variable specificationrange box and drag the mouse to en-ter the range C3 to C5. The labels in thisrange specify the categories for the rowvariable FundType in the contingencytable.

    Click in the Column variable datarange box and use the AutoExpand

    bow83755_app14_001-008.qxd 17/6/08 7:50 PM Page 14A-6

  • Appendix 14.3 Chi-Square Tests Using MegaStat 14A-7

    feature to enter the range B1 to B101. This de-fines the variable SRating to be the columnvariable in the contingency table.

    Click in the Column variable specification rangebox and drag the mouse to enter the range D3 toD5. The labels in this range specify the categoriesfor the column variable SRating in the contin-gency table.

    In the Output Options list, check the Chi-square checkbox to obtain the results of the chi-square test for independence.

    In the Output Options list, check the followingcheckboxes: % of row, % of column, and %of total.

    Click OK in the Crosstabulation dialogue box.

    Conducting the chi-square goodness of fittest for the scanner panel data in Exercise14.8 on page 534 (data file: ScanPan.xls):

    Enter the scanner panel data in Exercise14.8 (page 534) as shown in the screen-shot, with the number of purchases foreach brand in column C and the marketshare for each brand (expressed as a per-centage) in column D. Note that the totalnumber of purchases for all brands equals19,115 (which is in cell C11).

    In cell E4, type the cell formula=D4*19115 and press Enter to computethe expected frequency for the Jif/18ounce brand/size combination. Copy thiscell formula by double-clicking the draghandle in the lower right corner of cellE4 to compute the expected frequenciesfor each of the other brand/size combi-nations in cells E5 to E10.

    Select MegaStat : Chi-square/Crosstab :Goodness of Fit Test.

    In the Goodness of Fit Test dialoguebox, click in the Observed values inputrange box and enter the range C4 toC10. Enter this range by dragging withthe mousethe AutoExpand featurecannot be used in the Goodness of FitTest dialogue box.

    Click in the Expected values inputrange box, and enter the range E4 toE10. Again, enter this range by draggingwith the mouse.

    Click OK in the Goodness of Fit Testdialogue box.

    bow83755_app14_001-008.qxd 9/6/08 10:02 PM Page 14A-7

  • 14A-8 Chapter 14 Chi-Square Tests

    Conducting a chi-square test for independ-ence with contingency table input data inthe graduate degree situation of Exercise14.17 on page 542 (data file: GradSchool.xls):

    Enter the data just as you see it in thequestion on page 542.

    Select MegaStat : Chi-square/Crosstab :Contingency Table.

    In the Contingency Table Test for Independence dialogue box, click in theInput range box and (by dragging themouse) enter the range. Note that theentered range may contain row andcolumn labels, but the range should notinclude the row or column total.

    In the Output Options list, check theChi-square checkbox to obtain theresults of the chi-square test for inde-pendence.

    In the Output Options list, check thefollowing checkboxes: % of row, %of column, and % of total.

    Click OK in the Contingency Table Testfor Independence dialogue box.

    bow83755_app14_001-008.qxd 17/6/08 7:50 PM Page 14A-8