Anderson u Sweeney u Williams CONTEMPORARY BUSINESS STATISTICS WITH MICROSOFT EXCEL u Slides Prepared by JOHN LOUCKS u © 2001 South-Western/Thomson Learning Slide 1 Chapter 2 Descriptive Statistics I: Tabular and Graphical Methods Summarizing Qualitative Data Summarizing Quantitative Data Exploratory Data Analysis Crosstabulations and Scatter Diagrams Slide 2 Summarizing Qualitative Data Frequency Distribution Relative Frequency Percent Frequency Distribution Bar Graph Pie Chart Slide 3 Frequency Distribution A frequency distribution is a tabular summary of data showing the frequency (or number) of items in each of several nonoverlapping classes. The objective is to provide insights about the data that cannot be quickly obtained by looking only at the original data. Slide 4 Example: Marada Inn Guests staying at Marada Inn were asked to rate the quality of their accommodations as being excellent, above average, average, below average, or poor. The ratings provided by a sample of 20 quests are shown below. Below Average Average Above Average Above Average Above Average Above Average Above Average Below Average Below Average Average Poor Poor Above Average Excellent Above Average Average Above Average Average Above Average Average Slide 5 Example: Marada Inn Frequency Distribution Rating Frequency Poor 2 Below Average 3 Average 5 Above Average 9 Excellent 1 Total 20 Slide 6 Using Excel’s COUNTIF Function to Construct a Frequency Distribution 1 2 3 4 5 6 7 8 Formula Worksheet A Quality Rating Above Average Below Average Above Average Average Average Above Average Above Average B C Quality Rating Poor Below Average Average Above Average Excellent Total D Frequency =COUNTIF($A$2:$A$21,C2) =COUNTIF($A$2:$A$21,C3) =COUNTIF($A$2:$A$21,C4) =COUNTIF($A$2:$A$21,C5) =COUNTIF($A$2:$A$21,C6) =SUM(D2:D6) Note: Rows 9-21 are not shown. Slide 7 Using Excel’s COUNTIF Function to Construct a Frequency Distribution 1 2 3 4 5 6 7 8 Value Worksheet A Quality Rating Above Average Below Average Above Average Average Average Above Average Above Average B C Quality Rating Poor Below Average Average Above Average Excellent Total D Frequency 2 3 5 9 1 20 Note: Rows 9-21 are not shown. Slide 8 Relative Frequency and Percent Frequency Distributions The relative frequency of a class is the fraction or proportion of the total number of data items belonging to the class. A relative frequency distribution is a tabular summary of a set of data showing the relative frequency for each class. The percent frequency of a class is the relative frequency multiplied by 100. A percent frequency distribution is a tabular summary of a set of data showing the percent frequency for each class. Slide 9 Example: Marada Inn Relative Frequency and Percent Frequency Distributions Relative Percent Rating Frequency Frequency Poor .10 10 Below Average .15 15 Average .25 25 Above Average .45 45 Excellent .05 5 Total 1.00 100 Slide 10 Using Excel to Construct Relative Frequency and Percent Frequency Distributions 1 2 3 4 5 6 7 8 Formula Worksheet C D Quality Rating Poor Below Average Average Above Average Excellent Total Frequency =COUNTIF($A$2:$A$21,C2) =COUNTIF($A$2:$A$21,C3) =COUNTIF($A$2:$A$21,C4) =COUNTIF($A$2:$A$21,C5) =COUNTIF($A$2:$A$21,C6) =SUM(D2:D6) E Relative Frequency =D2/$D$7 =D3/$D$7 =D4/$D$7 =D5/$D$7 =D6/$D$7 =SUM(E2:E6) F Percent Frequency =E2*100 =E3*100 =E4*100 =E5*100 =E6*100 =SUM(F2:F6) Note: Rows 9-21 and Columns A-B are not shown. Slide 11 Using Excel to Construct Relative Frequency and Percent Frequency Distributions Value Worksheet C 1 2 3 4 5 6 7 8 Quality Rating Poor Below Average Average Above Average Excellent Total D Frequency 2 3 5 9 1 20 E Relative Frequency 0.10 0.15 0.25 0.45 0.05 1.00 F Percent Frequency 10 15 25 45 5 100 Note: Rows 9-21 and Columns A-B are not shown. Slide 12 Bar Graph A bar graph is a graphical device for depicting qualitative data that have been summarized in a frequency, relative frequency, or percent frequency distribution. On the horizontal axis we specify the labels that are used for each of the classes. A frequency, relative frequency, or percent frequency scale can be used for the vertical axis. Using a bar of fixed width drawn above each class label, we extend the height appropriately. The bars are separated to emphasize the fact that each class is a separate category. Slide 13 Example: Marada Inn Bar Graph 9 8 Frequency 7 6 5 4 3 2 1 Poor Below Average Above Excellent Average Average Rating Slide 14 Using Excel’s Chart Wizard to Construct Bar Graphs Step 1 Select cells A1:A21 Step 2 Select the Chart Wizard button Step 3 When the Chart Type dialog box appears: Choose Column in the Chart type list Choose Clustered Column from the Chart sub-type display Select Next > Step 4 When the Chart Source Data dialog box appears Select Next > … continued Slide 15 Using Excel’s Chart Wizard to Construct Bar Graphs Step 5 When the Chart Options dialog box appears: Select the Titles tab and then Type Bar Graph of Quality Ratings in the Chart title box Enter Quality Rating in the Value (X) axis box Enter Frequency in the Value (Y) axis box Select the Legend tab and then Remove the check in the Show Legend box Select Next > … continued Slide 16 Using Excel’s Chart Wizard to Construct Bar Graphs Step 6 When the Chart Location dialog box appears: Specify the location for the new chart Select Finish to display the bar graph Slide 17 Using Excel’s Chart Wizard to Construct Bar Graphs Bar Graph of Quality Ratings Frequency 9 10 11 12 13 14 15 16 17 18 19 20 21 E D C 10 8 6 4 2 0 Poor Below Average Average Above Average Excellent Quality Rating Slide 18 Pie Chart The pie chart is a commonly used graphical device for presenting relative frequency distributions for qualitative data. First draw a circle; then use the relative frequencies to subdivide the circle into sectors that correspond to the relative frequency for each class. Since there are 360 degrees in a circle, a class with a relative frequency of .25 would consume .25(360) = 90 degrees of the circle. Slide 19 Example: Marada Inn Pie Chart Exc. Poor 5% 10% Above Average 45% Below Average 15% Average 25% Quality Ratings Slide 20 Summarizing Quantitative Data Frequency Distribution Relative Frequency and Percent Frequency Distributions Histogram Cumulative Distributions Slide 21 Example: Hudson Auto Repair The manager of Hudson Auto would like to get a better picture of the distribution of costs for engine tune-up parts. A sample of 50 customer invoices has been taken and the costs of parts, rounded to the nearest dollar, are listed below. 91 71 104 85 62 78 69 74 97 82 93 72 62 88 98 57 89 68 68 101 75 66 97 83 79 52 75 105 68 105 99 79 77 71 79 80 75 65 69 69 97 72 80 67 62 62 76 109 74 73 Slide 22 Frequency Distribution Guidelines for Selecting Number of Classes • Use between 5 and 20 classes. • Data sets with a larger number of elements usually require a larger number of classes. • Smaller data sets usually require fewer classes. Guidelines for Selecting Width of Classes • Use classes of equal width. • Approximate Class Width = Largest Data Value Smallest Data Value Number of Classes Slide 23 Example: Hudson Auto Repair Frequency Distribution If we choose six classes: Approximate Class Width = (109 - 52)/6 = 9.5 10 Cost ($) 50-59 60-69 70-79 80-89 90-99 100-109 Frequency 2 13 16 7 7 5 Total 50 Slide 24 Using Excel’s FREQUENCY Function to Construct a Frequency Distribution Formula Worksheet (showing data entered) 1 2 3 4 5 6 7 8 A B Parts Cost 91 71 104 85 62 78 69 C Parts Cost 50-59 60-69 70-79 80-89 90-99 100-109 D Frequency Slide 25 Using Excel’s FREQUENCY Function to Construct a Frequency Distribution The FREQUENCY function is not a “simple” Excel function. FREQUENCY is capable of providing multiple values. In Excel, a formula that can return multiple values is called an array formula. An array formula must be entered in a special way. Slide 26 Using Excel’s FREQUENCY Function to Construct a Frequency Distribution Entering the Necessary Array Formula Step 1 Select D2:D7 (where the frequencies will appear) Step 2 Type the following formula: =FREQUENCY(A2:A51,{59,69,79,89,99,109}) Step 3 Hold down CTRL and SHIFT keys while pressing ENTER key (Array formula will be entered in D2:D7) Slide 27 Using Excel’s FREQUENCY Function to Construct a Frequency Distribution Value Worksheet 1 2 3 4 5 6 7 8 A B Parts Cost 91 71 104 85 62 78 69 C Parts Cost 50-59 60-69 70-79 80-89 90-99 100-109 D Frequency 2 13 16 7 7 5 Slide 28 Example: Hudson Auto Repair Relative Frequency and Percent Frequency Distributions Relative Percent Cost ($) Frequency Frequency 50-59 .04 4 60-69 .26 26 70-79 .32 32 80-89 .14 14 90-99 .14 14 100-109 .10 10 Total 1.00 100 Slide 29 Histogram Another common graphical presentation of quantitative data is a histogram. The variable of interest is placed on the horizontal axis and the frequency, relative frequency, or percent frequency is placed on the vertical axis. A rectangle is drawn above each class interval with its height corresponding to the interval’s frequency, relative frequency, or percent frequency. Unlike a bar graph, a histogram has no natural separation between rectangles of adjacent classes. Slide 30 Example: Hudson Auto Repair Histogram 18 16 14 Frequency 12 10 8 6 4 2 50 60 70 80 90 100 110 Cost ($) Slide 31 Using Excel’s Chart Wizard to Construct a Histogram Step 1 Select cells C1:D7 Step 2 Select the Chart Wizard button Step 3 When the Chart Type dialog box appears: Choose Column in the Chart type list Choose Clustered Column from the Chart sub-type display Select Next > Step 4 When the Chart Source Data dialog box appears Select Next > … continued Slide 32 Using Excel’s Chart Wizard to Construct a Histogram Step 5 When the Chart Options dialog box appears: Select the Titles tab and then Type Histogram for Parts Cost Data in the Chart title box Enter Parts Cost ($) in the Value (X) axis box Enter Frequency in the Value (Y) axis box Select the Legend tab and then Remove the check in the Show Legend box Select Next > … continued Slide 33 Using Excel’s Chart Wizard to Construct a Histogram Step 6 When the Chart Location dialog box appears: Specify the location for the new chart Select Finish to display the histogram Slide 34 Using Excel’s Chart Wizard to Construct a Histogram C E Histogram for Parts Cost Data 20 Frequency 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 D 15 10 5 0 50-59 60-69 70-79 80-89 90-99 100-109 Parts Cost ($) Slide 35 Using Excel’s Chart Wizard to Construct a Histogram Eliminating Gaps Between Rectangles Step 1 Right click on any rectangle in the column chart Step 2 Select the Format Data Series option Step 3 When the Format Data Series Option dialog box appears: Select the Options tab and then Enter 0 in the Gap width box Select OK Slide 36 Using Excel’s Chart Wizard to Construct a Histogram C E Histogram for Parts Cost Data 20 Frequency 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 D 15 10 5 0 50-59 60-69 70-79 80-89 90-99 100-109 Parts Cost ($) Slide 37 Cumulative Distribution The cumulative frequency distribution shows the number of items with values less than or equal to the upper limit of each class. The cumulative relative frequency distribution shows the proportion of items with values less than or equal to the upper limit of each class. The cumulative percent frequency distribution shows the percentage of items with values less than or equal to the upper limit of each class. Slide 38 Example: Hudson Auto Repair Cumulative Distributions Cost ($) < 59 < 69 < 79 < 89 < 99 < 109 Cumulative Cumulative Cumulative Relative Percent Frequency Frequency Frequency 2 .04 4 15 .30 30 31 .62 62 38 .76 76 45 .90 90 50 1.00 100 Slide 39 Ogive An ogive is a graph of a cumulative distribution. The data values are shown on the horizontal axis. Shown on the vertical axis are the: • cumulative frequencies, or • cumulative relative frequencies, or • cumulative percent frequencies The frequency (one of the above) of each class is plotted as a point. The plotted points are connected by straight lines. Slide 40 Example: Hudson Auto Repair Ogive with Cumulative Frequencies Cumulative Frequency 50 40 30 20 10 50 60 70 80 90 100 110 Parts Cost ($) Slide 41 Exploratory Data Analysis The techniques of exploratory data analysis consist of simple arithmetic and easy-to-draw pictures that can be used to summarize data quickly. One such technique is the stem-and-leaf display. Slide 42 Stem-and-Leaf Display This display shows both the rank order and shape of the distribution of the data. It is similar to a histogram on its side, but it has the advantage of showing the actual data values. The first digits of each data item are arranged to the left of a vertical line. To the right of the vertical line we record the last digit for each item in rank order. Each line in the display is referred to as a stem. Each digit on a stem is a leaf. Slide 43 Example: Hudson Auto Repair Stem-and-Leaf Display 5 6 7 8 9 10 2 2 1 0 1 1 7 2 1 0 3 4 2 2 2 7 5 2 2 3 7 5 5 3 5 7 9 6 4 8 8 7 8 8 8 9 9 9 4 5 5 5 6 7 8 9 9 9 9 9 Slide 44 Crosstabulations and Scatter Diagrams Thus far we have focused on methods that are used to summarize the data for one variable at a time. Often a manager is interested in tabular and graphical methods that will help understand the relationship between two variables. Crosstabulation and a scatter diagram are two methods for summarizing the data for two variables simultaneously. Slide 45 Example: Finger Lakes Homes Crosstabulation The number of Finger Lakes homes sold for each style and price for the past two years is shown below. Price Range < $99,000 > $99,000 Total Colonial Home Style Ranch Split A-Frame Total 18 12 6 14 19 16 12 3 55 45 30 20 35 15 100 Slide 46 Using Excel’s PivotTable Report to Construct a Crosstabulation Formula Worksheet (showing data entered) 1 2 3 4 5 6 7 8 9 A B Home Price ($) 1 >99K 2 <=99K 3 >99K 4 <=99K 5 <=99K 6 <=99K 7 >99K 8 >99K C Style Colonial Ranch Ranch A-Frame Colonial Split-Level A-Frame Colonial D E Note: Rows 10-101 are not shown. Slide 47 Using Excel’s PivotTable Report to Construct a Crosstabulation Changing the Default Order for the PivotTable Report Step 1 Select the Tools pull-down menu Step 2 Choose Options Step 3 When the Options dialog box appears: Select the Custom lists tab In the List entries: box, type <= 99K and press Enter, and type > 99K Select Add Select OK Slide 48 Using Excel’s PivotTable Report to Construct a Crosstabulation Using the PivotTable Report Step 1 Select the Data pull-down menu Step 2 Choose the PivotTable and PivotChart Report Step 3 When the PivotTable and PivotChart Wizard Step 1 of 3 dialog box appears: Choose Microsoft Excel list or database Choose PivotTable Select Next > Step 4 When the PivotTable and PivotChart Wizard Step 2 of 3 dialog box appears: Enter A1:C101 in the Range box Select Next > Slide 49 Using Excel’s PivotTable Report to Construct a Crosstabulation Using the PivotTable Report Step 5 When the PivotTable and PivotChart Wizard Step 3 of 3 dialog box appears: Select New Worksheet Click on the Layout button When the PivotTable and PivotChart Wizard – Layout diagram appears: Drag the Price ($) field button to the ROW section of the diagram Drag the Style field button to the COLUMN section of the diagram Slide 50 Using Excel’s PivotTable Report to Construct a Crosstabulation Using the PivotTable Report (Step 5 continued) Drag the Home field button to the DATA section of the diagram Double click the Sum of Home field button in the data section When the PivotTable Field dialog box appears: Choose Count under Summarized by: Select OK Select OK When the PivotTable and PivotChart Wizard Step 3 of 3 dialog box reappears: Select Finish> Slide 51 Using Excel’s PivotTable Report to Construct a Crosstabulation D 1 2 3 4 5 6 7 8 Value Worksheet E F G H I J Count of Home Style Price ($) Colonial Ranch Split-Level A-Frame Grand Total <=99K 18 6 19 12 55 >99K 12 14 16 3 45 Grand Total 30 20 35 15 100 Slide 52 Example: Panthers Football Team Scatter Diagram The Panthers football team is interested in investigating the relationship, if any, between interceptions made and points scored. x = Number of Interceptions 1 3 2 1 3 y = Number of Points Scored 14 24 18 17 27 Slide 53 Example: Panthers Football Team Scatter Diagram Number of Points Scored y 30 25 20 15 10 5 0 0 1 2 3 Number of Interceptions x Slide 54 Using Excel’s Chart Wizard to Construct a Scatter Diagram Formula Worksheet (showing data entered) 1 2 3 4 5 6 7 A Number of Interceptions 1 3 2 1 3 B Number of Points Scored 14 24 18 17 27 C Slide 55 Using Excel’s Chart Wizard to Construct a Scatter Diagram Producing a Scatter Diagram Step 1 Select cells A1:B6 Step 2 Select the Chart Wizard Step 3 When the Chart Type dialog box appears: Choose XY (Scatter) in the Chart type list Choose Scatter from the Chart sub-type display Select Next > Step 4 When the Chart Source Data dialog box appears Select Next > … continued Slide 56 Using Excel’s Chart Wizard to Construct a Scatter Diagram Producing a Scatter Diagram Step 5 When the Chart Options dialog box appears: Select the Titles tab and then Delete Number of Points Scored in the Chart title box Enter Number of Interceptions in the Value (X) axis box Enter Number of Points Scored in the Value (Y) axis box Select the Legend tab and then Remove the check in the Show Legend box Select Next > … continued Slide 57 Using Excel’s Chart Wizard to Construct a Scatter Diagram Producing a Scatter Diagram Step 6 When the Chart Location dialog box appears: Specify the location for the new chart Select Finish to display the scatter diagram Slide 58 Using Excel’s Chart Wizard to Construct a Scatter Diagram Value Worksheet A 8 9 10 11 12 13 14 15 16 17 18 19 20 B C Scatter Diagram for the Panthers 30 Number of Points Scored 20 10 0 0 1 2 3 4 Number of Interceptions Slide 59 Tabular and Graphical Procedures Data Qualitative Data Tabular Methods •Frequency Distribution •Rel. Freq. Dist. •% Freq. Dist. •Crosstabulation Graphical Methods •Bar Graph •Pie Chart Quantitative Data Tabular Methods •Frequency Distribution •Rel. Freq. Dist. •Cum. Freq. Dist. •Cum. Rel. Freq. Distribution •Stem-and-Leaf Display •Crosstabulation Graphical Methods •Dot Plot •Histogram •Ogive •Scatter Diagram Slide 60 End of Chapter 2 Slide 61