25
BIRD SONG SYSTEM Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create column graphs depicting the difference in mean weights between a sample of 10 males and 10 females. The tabulated data might look like this: The first step is to organize your data into a means table. This step is especially useful – Excel can use this simplified table to organize and categorize your data automatically, thus saving a lot of manual work. To obtain a mean, the formula is: =AVERAGE(select the cells that you want to calculate the mean of) In this example, for the mean weight of all the 10 males in our sample, the formula should be: =AVERAGE(B2:B11)

PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

BIRD SONG SYSTEM Using Microsoft Excel to Graph Data

– Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create column graphs depicting the difference in mean weights between a sample of 10 males and 10 females. The tabulated data might look like this:

The first step is to organize your data into a means table. This step is especially useful – Excel can use this simplified table to organize and categorize your data automatically, thus saving a lot of manual work. To obtain a mean, the formula is: =AVERAGE(select the cells that you want to calculate the mean of) In this example, for the mean weight of all the 10 males in our sample, the formula should be: =AVERAGE(B2:B11)

Page 2: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Hit Enter. The formula should now turn into the mean weight of all 10 males in our sample.

Repeat the process for Females. The completed table should look like this:

Page 3: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

We now have all the data we want to be graphed into one concise table. To “tell” Excel that we want a graph of those values, we need to highlight the entire table:

With the table highlighted, we will click on “Chart Wizard” in the Excel toolbar (the icon that looks like a colorful 3-D column graph). If this shortcut is not visible, you can access it from Insert � Chart.

Page 4: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

The Chart Wizard window should appear. Since a column graph is appropriate for our data, we will select “Column” under “Chart type:”, and go with the first Chart sub-type. Click “Next”.

Because we put all our values in a nice concise table, Excel has already picked out the relevant values and graphed it appropriately for us:

Page 5: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on “Next”.

Note that even though our X and Y axes have been labeled, the axes themselves have not. Thus, under “Category (X) axis”, we would enter “Sex”, and under “Value (Y) axis”, we will enter “Mean weight (kg)”. NEVER FORGET YOUR UNITS OF MEASUREMENT (e.g., cm, kg, mV, etc.)!

Page 6: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click “Next”.

This window merely asks you if you want your chart in the same worksheet you’ve been working on, or if you want it in a new worksheet on its own. Select your desired choice and click “Finish”. For this example, we will stick the chart in the same worksheet we’ve been working on.

Page 7: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

In most cases we would want the background to be white (instead of the default gray). To erase the background color, simply click on any region of the chart that is gray, and press the “delete” key.

We now have our basic column graph.

Page 8: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

PART 2: GRAPHING MORE THAN TWO GROUPS WITHIN ONE VARIABLE Suppose we have more than two groups in our sample that we want to graph. For example, we may be interested in the average weights of individuals in 4 categories: Children (5-12 years old), Teens (13-19 years old), Middle-aged (30-40 years old), and Seniors (65-80 years old). We sample 10 subjects from each age group. The tabulated data may look like this:

Again, we begin by organizing the data into a means table using the AVERAGE formula so that we end up with only one mean per group:

Now we highlight the entire table, and then click on the “Chart Wizard” button:

Page 9: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Since we want a column graph, we can just leave the default option alone and click “Next”:

Excel should automatically figure out the appropriate graph, as can be seen in the preview window:

Page 10: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on “Next”. On the following window, enter all relevant information (e.g., Name your X and Y axes):

Once you click “Finish”, everything should look like this:

Page 11: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

As before, remove the grey color by clicking on any grey region and hitting the “delete” key:

And there we have it – a column graph with more than two groups.

Page 12: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

PART 3: (SLIGHTLY) ADVANCED GRAPHING WITH EXCEL: ERROR BARS In scientific journals, a graph with no error bars is an incomplete graph. An error bar indicates the variance, or “spread” of the data, and can serve as a quick visual gauge as to how different (or similar) our two mean values are. The more different they are, the more likely that the difference is significantly different, and vice-versa. As a measure of “spread”, the most commonly used indicator is the standard error, which is defined as the standard deviation divided by the square root of n (where n = the number of samples in each group. We will return to the two-group (Male vs. Female) example for simplicity. In that sample, n = 10 for both males and females since we have 10 males and 10 females. Excel has a formula that allows us to easily calculate the standard deviation, but unfortunately, not the standard error. Thus, we’ll have to calculate it ourselves. The formulae we need are: =STDEV(pick the cells that we want the standard deviation of) and: =SQRT(n) � This gives us the square root of n. We can calculate the standard error in one compounded formula by the following: (1) Start by creating a table similar to the one we used to construct our column graphs:

(2) We’ll do the standard error for males first. Highlight the cell that we want the value in.

Page 13: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

(3) Now it’s time to enter the formula. Begin by entering:

=STDEV(

Page 14: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

(4) Now, select the data that we want to create the standard deviation of. We will highlight all the values in our “Males” column:

(5) Close the STDEV formula with a close parenthesis so that the formula looks like:

=STDEV(B2:B11) (6) We need to now divide this standard deviation by the square root of n. Continue typing:

=STDEV(B2:B11)/SQRT(10) Whereby 10 is the number of subjects in our “Male” condition. Hit enter. (7) Voila – we have now the standard error for our males. If we repeat the same process for the females, we should get:

Page 15: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Now that we have the standard error, we can incorporate them into our graph as error bars. Right click on either one of the columns in our graph. A menu should appear:

Select “Format Data Series”.

Page 16: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on the “Y Error Bars” tab.

Since “Standard Error” is not an option, we will have to manually tell Excel what values we want to serve as our error bars. Under “Display”, click on “Both”. Then click on the round button for “Custom”, and click on the button on the right of the “+” field. This will tell Excel what values to pick as the upper bound. Note that since our table for Standard Error is EXACTLY the same in format as our mean weight table, we can select the Standard Error values for both the Males and Females at the same time. Excel will automatically figure out which error bars belong to which mean. Click on enter, and then repeat the same process for the “-” field (i.e. again select the Standard Error values for both the Males and Females – this tells Excel what to use as a lower bound for our error bars).

Page 17: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

After you’ve done the same for Females, hit Enter. The window should now look like this:

Click “OK”.

Page 18: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

We now have our graph, complete with error bars.

Page 19: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

PART 4: (EVEN MORE) ADVANCED GRAPHING WITH EXCEL: MAKING GRAPHS WITH MORE THAN ONE VARIABLE So far, we have only been dealing with one variable (weight). What if we want to graph something with two variables? Suppose we want to test the effectiveness of a weight-loss program for males and females. Thus, for both males and females, each subject is going to have a “Before” weight and an “After” weight (i.e., weights taken before the program, and after the program). Fortunately, Excel allows us to make graphs with more than one variable very easily – as long as we create a good table from the raw data, like so:

(Note that the format of the Standard Error table looks EXACTLY like the Mean Weight table, except for the numbers. This is important!!) Once you have the data organized like this, highlight the data that we want to graph:

Page 20: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on the “Chart Wizard” button, and like before, select “Column” under “Chart type”, select the first option under “Chart sub-type”, and click on “Next”.

Presto! Excel has already done the appropriate labeling and grouping. You only need to tell Excel which variable (i.e., “Weight Before/After” or “Male/Female”) you want on the X or Y axis. Since in this example, we want to compare the effectiveness of the weight loss program for males and females separately, it would make more sense to make “Sex” our X-axis. To do this, simply click on “Columns” in the “Series in:” portion.

Page 21: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on Next.

Note that from the data we’ve entered in our nice table that we selected to make this graph from, the axes have already been pre-entered. We just need to tweak it to perfection by adding (“kg”) after “Mean Weight”, deleting “Sex” under “Category (X) axis” (since Excel has already labeled it for us), and if we want, enter a Chart title.

Page 22: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Click on “Next” to select where you want your chart, click on “Finish”, get rid of the gray background, and we’ve got our chart!

Page 23: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

The final finishing touch would be the addition of the error bars. The process is almost exactly the same as adding error bars in our one-variable example (once we’ve calculated our Standard Errors and put them in a nice table, that is). We’ll need to enter the error bars twice: Once for “Before”, and once for “After”. To make our error bars for “Before”, right click on any bar for “Before”, and select “Format Data Series”:

As before, select the “Y Error Bars” tab, and click on “Both” under “Display”. Then click on the round button next to “Custom”.

We’ll now need to tell Excel which values we want to use as the upper and lower bound for the “Before” condition. Once again, click on the button to the right of the “+” field, and select both values under the “Before” condition:

Page 24: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create

Repeat the same for the “-” field for the “Before” condition (select exactly the same two cells), click on OK, and we will have our error bars for the “Before” condition.

Last step: Repeat the same process to obtain the error bars for the “After” condition (using the Standard Error values under the “After” column), and we’re done!

Page 25: PART 1: BASIC GRAPHING WITH EXCEL · 11/1/2010  · Using Microsoft Excel to Graph Data – Courtesy of Jared Wong – PART 1: BASIC GRAPHING WITH EXCEL Suppose we want to create