Statistics
Statistics
qxd
11/1/07
1:41 PM
Page 1
Microsoft Excel 2007, part of the Microsoft Office 2007 system, is a spreadsheet program that can be used to organize and analyze data, perform complex calculations, and create a wide variety of graphical displays. We assume readers of this primer are familiar with basic Excel operations such as selecting cells, entering formulas, copying, and so on. But, we do not assume readers are familiar with Excel 2007 or the use of Excel for statistical analysis. The purpose of this primer is twofold. First, we provide an overview of Excel 2007 and discuss the basic operations needed to work with Excel 2007 workbooks and worksheets. Second, we provide an overview of the tools that are available for conducting statistical analysis with Excel. These include Excel functions and formulas which allow users to conduct their own analyses and add-ins that provide more comprehensive analysis tools. Excels Data Analysis add-in, included with the basic Excel system, is a valuable tool for conducting statistical analysis. In the last section of this primer we provide instructions for installing the Data Analysis add-in. Other add-ins have been developed by outside suppliers to supplement the basic statistical capabilities provided by Excel. In the last section we also discuss two commercially available add-ins developed by Palisade Corporation: StatTools and PrecisionTree.
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 2
Name of Workbook
Ribbon
Cell A1 is selected
The Formula Bar contains a Name box, the Insert Function button , and a Formula box. In Figure 3, A1 appears in the Name box because cell A1 is selected. You can select any other cell in the worksheet by using the mouse to move the cursor to another cell and clicking or by typing the new cell location in the name box. The Formula box is used to display the formula in the currently selected cell. For instance, if you had entered A1 A2 into cell A3, whenever you select cell A3 the formula A1 A2 will be shown in the Formula box. This feature makes it very easy to see and edit a formula in a particular cell. The Insert Function button allows you to quickly access all of the functions available in Excel. Later we show how to find and use a particular function.
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 3
FIGURE 2
Home Tab
Clipboard Group
Font Group
Alignment Group
Number Group
FIGURE 3 EXCEL 2007 OFFICE BUTTON, QUICK ACCESS TOOLBAR, AND FORMULA BAR
Office Button
Formula Bar
Name Box
Formula Box
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 4
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 5
TABLE 1
DATA FROM A SAMPLE OF 50 SOFT DRINK PURCHASES Coke Classic Diet Coke Pepsi Diet Coke Coke Classic Coke Classic Dr. Pepper Diet Coke Pepsi Pepsi Coke Classic Dr. Pepper Sprite Coke Classic Diet Coke Coke Classic Coke Classic Sprite Coke Classic Diet Coke Coke Classic Diet Coke Coke Classic Sprite Pepsi Coke Classic Coke Classic Coke Classic Pepsi Coke Classic Sprite Dr. Pepper Pepsi Diet Coke Pepsi Coke Classic Coke Classic Coke Classic Pepsi Dr. Pepper Coke Classic Diet Coke Pepsi Pepsi Pepsi Pepsi Coke Classic Dr. Pepper Pepsi Sprite
Step 3: When the New Workbook dialog box appears: Select Blank and recent under Templates Double click Blank Workbook A new workbook containing three worksheets labeled Sheet1, Sheet2, and Sheet3 will appear. Suppose we want to enter the data for the sample of 50 soft drink purchases into Sheet1 of the new workbook. First, we enter the label Brand Purchased into cell A1; then, we enter the data for the 50 soft drink purchases into cells A2:A51. As a reminder that this worksheet contains the data, we will change the name of the worksheet from Sheet1 to Data using the procedure described previously. Figure 5 shows the data worksheet we have just developed. Before doing any analysis with these data, we recommend that you first save the file; this will save you from having to reenter the data in case something happens that causes Excel to close. To save the workbook using the filename SoftDrink we perform the following steps:
Keyboard shortcut: To save the file, press CTRL S
Step 1: Click the Office button Step 2: Click Save As in the list of options Step 3: When the Save As dialog box appears: In the Save in box select the location where you want to save the file Type the filename SoftDrink in the File name box Click Save Excels Save command is designed to save the file as an Excel 2007 workbook. As you work with the file to do statistical analysis you should follow the practice of periodically saving the file so you will not lose any statistical analysis you may have performed. Simply follow the procedure described above using the Save command. Sometimes you may want to create a copy of an existing file. For instance, suppose you would like to save the soft drink data and any resulting statistical analysis in a new file
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 6
Brand Purchased
Coke Classic Diet Coke Pepsi Diet Coke Coke Classic Coke Classic Dr. Pepper Diet Coke Pepsi Pepsi Coke Classic Dr. Pepper Sprite Coke Classic Diet Coke Coke Classic Coke Classic Sprite Coke Classic Pepsi Sprite
named SoftDrink Analysis. The following steps show how to create a copy of the SoftDrink workbook and analysis with the new filename, SoftDrink Analysis. Step 1: Step 2: Step 3: Step 4: Click the Office button Position the mouse pointer over Save As Click Excel Workbook from the list of options When the Save As dialog box appears: In the Save in box select the location where you want to save the file Type the filename SoftDrink Analysis in the File name box Click Save
Once the workbook has been saved, you can continue to work with the data to perform whatever type of statistical analysis is appropriate. When you are finished working with the file simply click the close window button located at the top right-hand corner of the Ribbon. To access the SoftDrink Analysis file at another point in time you can open the file by performing the following steps: Step 1: Click the Office button Step 2: Click Open in the list of options
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 7
Step 3: When the Open dialog box appears: In the Look in box select the location where you previously saved the file Enter the filename SoftDrink in the File name box Click Open The procedures we showed for saving or opening a workbook begin by clicking on the Office Button to access the Save and Open commands. Once you have used Excel for awhile you will probably find it more convenient to add these commands to the Quick Access Toolbar.
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 8
The Search for a function box at the top of the Insert Function dialog box enables us to type a brief description of what we want to do. After doing so and clicking Go, Excel will search for and display, in the Select a function box, the functions that may accomplish our task. In many situations, however, we may want to browse through an entire category of functions to see what is available. For this task, the Or select a category box is helpful. It contains a drop-down list of several categories of functions provided by Excel. Figure 6 shows that we selected the Statistical category. As a result, Excels statistical functions appear in alphabetic order in the Select a function box. We see the AVEDEV function listed first, followed by the AVERAGE function, and so on. The AVEDEV function is highlighted in Figure 6, indicating it is the function currently selected. The proper syntax for the function and a brief description of the function appear below the Select a function box. We can scroll through the list in the Select a function box to display the syntax and a brief description for each of the statistical functions that are available. For instance, scrolling down farther, we select the COUNTIF function as shown in Figure 7. Note that COUNTIF is now highlighted, and that immediately below the Select a function box we see COUNTIF(range,criteria), which indicates that the COUNTIF function contains two arguments, range and criteria. In addition, we see that the description of the COUNTIF function is Counts the number of cells within a range that meet the given condition. If the function selected (highlighted) is the one we want to use, we click OK; the Function Arguments dialog box then appears. The Function Arguments dialog box for the COUNTIF function is shown in Figure 8. This dialog box assists in creating the appropriate FIGURE 7 DESCRIPTION OF THE COUNTIF FUNCTION IN THE INSERT FUNCTION DIALOG BOX
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 9
arguments for the function selected. When finished entering the arguments, we click OK; Excel then inserts the function into a worksheet cell.
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 10
10
FIGURE 9 EXCEL WORKSHEET WITH SOFT DRINK DATA AND LABELS FOR THE FREQUENCY DISTRIBUTION WE WOULD LIKE TO CONSTRUCT
A 1 2 3 4 5 6 7 8 9 10 45 46 47 48 49 50 51 52 B C D E F
Brand Purchased
Coke Classic Diet Coke Pepsi Diet Coke Coke Classic Coke Classic Dr. Pepper Diet Coke Pepsi Pepsi Pepsi Pepsi Coke Classic Dr. Pepper Pepsi Sprite
Soft Drink
Coke Classic Diet Coke Dr. Pepper Pepsi-Cola Sprite
Frequency
FIGURE 10 COMPLETED FUNCTION ARGUMENTS DIALOG BOX FOR THE COUNTIF FUNCTION
the COUNTIF function was inserted into cells D2:D6. The value worksheet shows the proper class frequencies as computed. We illustrated the use of Excels capability to provide assistance in using the COUNTIF function. The procedure is similar for all Excel functions. This capability is especially helpful if you do not know what function to use or forget the proper name and/or syntax for a function.
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 11
11
FIGURE 11 EXCEL WORKSHEET SHOWING THE USE OF EXCELS COUNTIF FUNCTION TO CONSTRUCT A FREQUENCY DISTRIBUTION
A 1 2 3 4 5 6 7 8 9 10 45 46 47 48 49 50 51 52 B C D E
Brand Purchased
Coke Classic Diet Coke Pepsi Diet Coke Coke Classic Coke Classic Dr. Pepper Diet Coke Pepsi Pepsi Pepsi Pepsi Coke Classic Dr. Pepper Pepsi Sprite
Soft Drink
Coke Classic Diet Coke Dr. Pepper Pepsi-Cola Sprite
Frequency
COUNTIF($A$2:$A$51,C2) COUNTIF($A$2:$A$51,C3) COUNTIF($A$2:$A$51,C4) COUNTIF($A$2:$A$51,C5) COUNTIF($A$2:$A$51,C6)
A 1 2 3 4 5 6 7 8 9 10 45 46 47 48 49 50 51 52
E 19 8 5 13 5
Brand Purchased
Coke Classic Diet Coke Pepsi Diet Coke Coke Classic Coke Classic Dr. Pepper Diet Coke Pepsi Pepsi Pepsi Pepsi Coke Classic Dr. Pepper Pepsi Sprite
Soft Drink
Coke Classic Diet Coke Dr. Pepper Pepsi-Cola Sprite
Frequency
ASW_MBS_Primer_Web.qxd
11/1/07
1:41 PM
Page 12
12
Step 4: When the Add-Ins dialog box appears: Select Analysis ToolPak Click OK