Docsity

Guide to using Microsoft Excel, Slides of Statistics

Toggle sidebar
bg1
1
Guide to using Microsoft Excel®
Contents
Entering Data
Co-ordinates
Descriptive Statistics
Excel®equations
Inferential statistics with Excel®
F-test
t-tests
z-test
ANOVA
Correlation and Regression
Chi-Square
Additional software and reading
Introduction
Microsoft Excel® is a widely available, relatively inexpensive, computer package. It
can be run on most computers and is available from a wide variety of stores and
suppliers. Microsoft Excel® is not specifically designed to be a statistical package; it
is, in fact, a spreadsheet. Spreadsheets are computer packages that were originally
designed to allow data to be easily manipulated and handled. Microsoft Excel® is
very versatile and the package comes with basic statistical functions. It can also be
used to produce tables and graphs. Microsoft Excel’s abilities to perform statistical
functions can be upgraded. Microsoft Excel® comes as part of Microsoft’s Office
suite of packages and thus can be found on many of the world’s computers. The
statistical utilities the package comes with are limited, and do not cover all the
statistics described in the book. In particular very few non-parametric statistical tests
are available via Excel®. Some professional statisticians have criticised Excel® for
producing inaccurate statistics. If you are thinking of analysing a large more complex
set of data then a package like SPSS may be more suitable. Alternatively, you can by
software that can extend Excel’s capabilities.
Entering data
Advice is given in the book on coding data. In general use a column for each variable
and a row for each case. If recording the heights of a number of different subjects
variables you could include things like, age, sex, country of birth and of course
height. Each variable would have its own column and each case its own row. In
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Guide to using Microsoft Excel and more Slides Statistics in PDF only on Docsity!

Guide to using Microsoft Excel®

Contents

Entering Data Co-ordinates Descriptive Statistics Excel®equations Inferential statistics with Excel® F-test t-tests z-test ANOVA Correlation and Regression Chi-Square Additional software and reading

Introduction

Microsoft Excel® is a widely available, relatively inexpensive, computer package. It can be run on most computers and is available from a wide variety of stores and suppliers. Microsoft Excel® is not specifically designed to be a statistical package; it is, in fact, a spreadsheet. Spreadsheets are computer packages that were originally designed to allow data to be easily manipulated and handled. Microsoft Excel® is very versatile and the package comes with basic statistical functions. It can also be used to produce tables and graphs. Microsoft Excel’s abilities to perform statistical functions can be upgraded. Microsoft Excel® comes as part of Microsoft’s Office suite of packages and thus can be found on many of the world’s computers. The statistical utilities the package comes with are limited, and do not cover all the statistics described in the book. In particular very few non-parametric statistical tests are available via Excel®. Some professional statisticians have criticised Excel® for producing inaccurate statistics. If you are thinking of analysing a large more complex set of data then a package like SPSS may be more suitable. Alternatively, you can by software that can extend Excel’s capabilities.

Entering data

Advice is given in the book on coding data. In general use a column for each variable and a row for each case. If recording the heights of a number of different subjects variables you could include things like, age, sex, country of birth and of course height. Each variable would have its own column and each case its own row. In

Excel® data is entered on to what is called a worksheet. If you click on the Excel® icon it will normally open with a new worksheet as in Figure 1.

Notice how the columns are marked with letters and the rows with numbers. Each box on the spreadsheet is known as a cell. Enter the data by typing into the cells. The cell where data is being entered is termed the active cell. The outline of the active cell is highlighted in black.

Co-ordinates

You can identify an individual cell from co-ordinates formed by the letter that denotes its columns and the number that denotes its row. Thus A1 is the first cell of the spreadsheet. The co-ordinates that locate the cells are a very important aspect of spreadsheets.

These co-ordinates are used to tell the programme which numbers to perform calculations upon. If we gave Excel® the command A16 it would indicate that we want to multiply whatever number was in the cell A1 by 6. Similarly, if we gave the command A1B2 it would indicate that we wanted Excel® to multiply the number in

Figure 1: An Excel® workbook.

Figure 2: Excel® spreadsheet indicating an array of

data

additional active cells as you call up more statistics. Commonly required descriptive statistics and their function name (Figure 3) in Excel® are given below (Table 1).

Statistic Function Name Arithmetic Mean AVERAGE Standard Deviation STDEV Variance VAR Sample Size COUNT Mode MODE Median MEDIAN Maximum MAX Minimum MIN Quartiles QUARTILE: Need to specify which quartile in a separate cell Range No function need to calculate just subtract Minimum from Max (see Chapter 6)

Excel® Equations

You may have noticed that when you use the statistics functions that Excel® writes information into the formula bar. You can find the formula bar just below the toolbars. Simultaneously to writing into the formula bar the same information will be written to the active cell. What Excel® is doing is writing a formula that reflects the statistical procedures that you are asking it to perform. Indeed it is possible not to use the dialogue boxes described above and write your own formulas. For simple calculations you may want to do this as it is sometimes a faster option.

Figure 4: Calculating the average (Mean)

If, for example, you want to add lots of numbers together you can use Excel’s Sum facility. To use this facility first highlight the column of numbers that you wish to add together, and press the button marked . You will see that the numbers in the column will be added together and the sum placed in the cell at the bottom of the column that was highlighted.

If you activate the cell that contains the Sum you will see in the formula bar that an equation is written. The form of that equation will be SUM (Co-ordinates of first cell highlighted: Co-ordinates of the last cell co-ordinated). The formula bar informs the operator what procedures are being applied to the active cell. Thus = SUM (A1: A5) informs us that the number in the active cell is the summation of those values between and including cells A1 to A5. Cells can also be summed across rows using the same procedure that has been described for columns above. You can tell that a cell contains a formula because the content of the cell will start with an = sign. You can write formulas of your own and apply them to new cells using standard computer mathematical notation. Some of the commonly used symbols are listed below.

/ = divide

  • = multiplied by
  • = minus
  • = plus ** = square of Log10 (Co-ordinate) = Logarithm to the base 10 of the number at the co-ordinates in brackets.

To write a formula, first click on the cell where you want the answer to your calculation to appear. If, for example, you want to calculate an average (mean), you can simply write = AVERAGE(A2:A33). The mean for the numbers between the cells A2 and A33 will be calculated. If you had written =A2/A33 then Excel® would divide the number in cell A2 by that in cell A33. Note, that even when you use the dialogue boxes Excel® still actually works by using formulas. The dialogue boxes simply make writing the formulas easier (they do it for you).

You can repeat the formula for other columns (or rows) of data. When you want to repeat a calculation procedure across columns or down rows you can use Microsoft Excel’s Copy and Paste facility.

If you want to calculate the mean for when you have highlighted the correct cells type Ctrl-c on the key board (i.e. press the keyboard key marked Ctrl and at the same time press the key marked c, Use the same action as when using the shift key to

There seems to be no direct way of calculating a standard error in Excel®, but if you obtain the standard deviation of your sample, the standard error can then be calculated using the formula given in chapter 11 of the book.

Z, T and F tests. (Chapter 12)

An F-test can be obtained from Excel® by using the function key and then selecting FTEST. Here some of the issues with regard to using a spreadsheet rather than a programme dedicated just to statistics will emerge. The dialogue boxes you see that ask for two arrays of numbers to be entered – array is another word for list. Each of the arrays is formed from one of the samples that you wish to compare, experiment and control for example. If, however, you have followed our advice and entered the data in columns, you will have just one array for each variable, with a separate column indicating which sample each case belongs to (see Figure 6). To overcome this problem, when using Excel®, you will need to copy and paste each sample into a separate column. This is why we do not recommend the basic version of Excel® or anything other than simple data sets.

Let us say we wanted to examine the data from the syphadiol experiment and decided to perform an F-test to compare the variance of the heights of the sample of participants in group 1 with those of group 2.

We would first need to cut and paste the data into separate columns (see Figure 6). It is good practice to give these new columns headings, such that you do not forget which sample they belong to. In figure 6 we have cut out the data for group 1 and group 2 and placed them in to the columns G and H. Next, you call up the Statistical dialogue box in the normal way and select FTEST. You indicate in the

Figure 6: Excel® workbook showing the heights of the participants in treatment groups 1 and 2 copied into columns G and H.

Figure 7: Using a dialogue box (F-Test) to indicate the location of arrays of data.

dialogue box the groups you want to compare; remember you need to give the location of each of the columns (arrays). For group 1 the array is G5:G19 and for Group 2 it is H5:H19 (Figure 7). If you remember that when describing the array the colon stands for “to” they are easier to understand. Thus G5:G19 simply tells the computer to use the numbers from G5 to G19.

For the F-test the result will appear at the bottom of the dialogue box where you have just entered the location of the data to be analysed. When you click OK the result will also be entered into the active cell. The result you obtain will be the P value for the test. The value for F is not actually given. You cannot just present the F value you will need to give the statistic as well as the degrees of freedom.

The actual value can be calculated by selecting the command FINV from the Statistical menu. You will be asked to input the probability (you have just calculated this) and the degrees of freedom from the two samples you are comparing. The degrees of freedom from the smaller sample is entered first.

An alternative to the described route to obtain an F-test is to use the Data Analysis sub-set of Excel®. This can be obtained from the Data menu (far end of the tool bar). Unfortunately When the Excel® package is loaded on to computers, sometimes the data analysis omitted. This facility can be loaded at anytime by going to the File menu and then selecting Options (down the bottom). Next select Analysis toolpak click the check box and then OK.

We will look at the students-t test using this facility – you will find that using the Data Analysis option will give you more output than that from the function facility. We will analysis the same data set as used for the F-test.

Having loaded the Analysis toolpak select Data Analysis from the Data menu, then select an appropriate t-test, there are three on offer; given that the F-tests indicates

one-tailed test, this is the value that, if you were performing a t-test by hand, you would look up from the t-distribution tables. It is the value that the t-statistic is compared against. In the last two rows the same information is given but for a two- tailed test.

Figure 9: The output from the t-test

Paired-t-test

The paired-t-test follows exactly the same format as the other t-tests. You must, however remember that numbers in the same row as each other will be treated as a pair (a repeat measure) thus, you must set up your data accordingly.

Z-Test

The procedure for conducting a Z test is similar to that for the t-test accept that you will need to know the variance of each sample, these can be calculated using the function key and the VAR command.

ANOVA (Chapter 13).

Calculating an ANOVA using Excel® is similar to calculating a t-test. You must have loaded the Analysis toolpak and then click-on Data Analysis from the Data menu, then select an appropriate ANOVA. There are three tests on offer, single factor, two factor with replication and two factor without replication. Single factor is analogous to the one-way ANOVA and two factor with the two-way ANOVA. The Two-way ANOVA without replication is not covered in the textbook.

We will do a single factor analysis comparing the means of the heights of each of the four treatment groups from the symphadiol experiment. As with the other tests you will need to copy and paste each sample (treatment group) of heights into a separate column (Figure 10).

Next from the Tools menu select Data Analysis , and click on one factor ANOVA. You must now tell Excel® how the data are arranged (columns or rows). In this example we have arranged the data in columns. So columns is selected. You must then, as always, indicate were the data are located. This time you must enter the co- ordinates for the block of data being analysed. Enter the co-ordinates in the Input Range box (Figure 10).

In the dialogue box you are also asked to enter a value for alpha. This is equivalent to the significance level that you want to use for rejection of the null-hypothesis. It is the probability level that Excel® will use to produce the critical value for F. Finally you have the option of selecting where the output will be placed – we recommend selecting the default and allowing a new worksheet to be produced.

Figure 10: Arranging the data into separate columns and the ANOVA dialogue box.

You can also find correlation and regression by clicking-on Data Analysis from the Data menu. The output, however for the correlation achieved by using this method is the same as in that described above and we do not recommend this approach. For regression however, the Data Analysis command provides a good rapid method to obtain regression statistics (Figure 12). First select regression from the Statistical sub-set of the Data Analysis menu; you then need define the arrays of data that you wish to compare. Enter the array co-ordinates in to the dialogue box (Figure 12). You then have various options to select.

You can adjust the confidence limits used by clicking in the Confidence limits check box and then altering the value in the adjacent box. You can also select options that will help you analyse residuals. Residuals are beyond the scope of the textbook. Residuals can be used to provide insight into your data and to see if your data meet the assumption behind the regression analysis.

The output from this analysis comes in the form of three tables (Figure 13), one to provide correlation statistics, an ANOVA table and a table of statistics covering the regression equation.

The regression summary, gives the Pearson’s correlation coefficient (given as Multiple R) and the coefficient of determination (given as R Square). You can ignore the Adjusted R square value as this should be used only when the analysis has used more than one y variable. The ANOVA table may appear slightly out-of-place, after all you had asked for a regression analysis to be performed. ANOVA and regression are very similar procedures and it is common for statistical packages to use an ANOVA to determine the significance of the correlation between variables. Thus, the value in this table given as the “Significance of F” is the P value for the regression coefficient.

Figure 12: The regression analysis dialogue box.

In the final table, separate statistics for the slope term (weight) and for the intercept. The values for intercept and for the slope term are given under the heading coefficients. Thus the equation for this regression is:

y= 173.5+ Weight(0.37).

The table also gives the standard errors for each of these terms as well as t-test to determine their significance from the value of 0. Note how the significance value for the t statistic is the same as that for the F statistic from the ANOVA table. Finally, the table also provides lower and upper 95% confidence limits.

Chi-Square tests (Chapter 16)

There is no direct method for obtaining a chi-square test using Excel®. The mathematics of the chi-square test however is relatively straightforward and therefore Excel’s calculation function can be used to perform such tests. The information you need to supply Excel® is a list the observed values and a list of expected values. The textbook covers how the expected values should be determined, the method of their determination will vary depending on the type of chi-square test.

The observed and the expected frequencies values can be entered as separate columns or as separate contingency tables (see Chapter 16). Once you have done

this click fx and select Statistical and choose CHITEST , enter the arrays for the

observed frequencies (actual_range box) and then the expected frequencies. When you then click OK the result (the P value) will be placed in the active cell. The significance level used is P=0.05). It is not sufficient to give just a P value for a statistical test you must also provide the degrees of freedom used and the value of

Figure 13: The output from the regression analysis