Docsity

Using MS Excel for Regression: Step-by-Step Guide to Calculate Logs & Create Scatter Plot , Assignments of Ecology and Environment

Toggle sidebar
bg1
USING MS EXCEL TO PLOT A REGRESSION
NOTE: This problem is just like Problem 4 of the Practice Population Problems handed out in lab, but uses a different
data set. Before doing the actual problem in Assignment #2, try following these instructions using the data from the
Practice Problems and see if you come up with a graph that looks like the one at the end of these instructions. Let me
know if you encounter any difficulties.
The following instructions are quite detailed, in order to help those for whom Microsoft Excel is still intimidating. If you know
something of Excel’s capabilities, you may want to just skim through the instructions, stopping only for procedures you may not be
familiar with.
1. First, you’ll need to enter the raw data by simply typing the values into the cells of the spreadsheet. In this case, use the pattern
shown in the screen capture below so that when I refer to a specific column or cell in these instructions, my reference will match your
own work.
2. Recheck all of your entries to make sure they’re correct. Next we’ll create a column containing the natural log of the population,
since that is what is asked for in the problem. In cell C1, type a name for the column; I’ve called it “ln(N)”. Then click on cell C2,
and type in only the following “=ln(” (without the quotation marks), as I’ve done below. Since this is a stock equation in Excel, a
small box will pop up showing the pattern for completing the equation.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Using MS Excel for Regression: Step-by-Step Guide to Calculate Logs & Create Scatter Plot and more Assignments Ecology and Environment in PDF only on Docsity!

USING MS EXCEL TO PLOT A REGRESSION

NOTE: This problem is just like Problem 4 of the Practice Population Problems handed out in lab, but uses a different data set. Before doing the actual problem in Assignment #2, try following these instructions using the data from the Practice Problems and see if you come up with a graph that looks like the one at the end of these instructions. Let me know if you encounter any difficulties. The following instructions are quite detailed, in order to help those for whom Microsoft Excel is still intimidating. If you know something of Excel’s capabilities, you may want to just skim through the instructions, stopping only for procedures you may not be familiar with.

  1. First, you’ll need to enter the raw data by simply typing the values into the cells of the spreadsheet. In this case, use the pattern shown in the screen capture below so that when I refer to a specific column or cell in these instructions, my reference will match your own work.
  2. Recheck all of your entries to make sure they’re correct. Next we’ll create a column containing the natural log of the population, since that is what is asked for in the problem. In cell C1, type a name for the column; I’ve called it “ln( N )”. Then click on cell C2, and type in only the following “=ln(” (without the quotation marks), as I’ve done below. Since this is a stock equation in Excel, a small box will pop up showing the pattern for completing the equation.
  1. Rather than type in 64 (the first population value for which we want to calculate the natural log), click on the cell that contains the 1—cell B2. Then close the parentheses. It should now look like the following:
  2. Hit Enter, and the value will be entered into the cell, as you see below.
  1. Choose “Number” from the list of categories, and set the “Decimal places” box to 2. Hit OK, and the values in those cells will now be expressed to just two decimal places.
  2. The data are now ready for graphing. Select column A and then, holding down the Control key (“Ctrl” on my keyboard), select column C. (Recall that we are plotting ln( N )—and not N —against time.) Holding the Control key allows you to select two separate columns without automatically selecting the columns in between. From the Insert menu, select “Chart.”
  1. In the “Step 1 of 4” window of the Chart Wizard, choose “XY (Scatter)”, leaving the “Chart sub-type” on the default choice: plotted points without lines connecting them. Click on the Next button.
  2. In the Step 2 window, you can see a small version of what the graph will look like. There are some things that will need fixing, but we can’t fix them until the graph is created. Click Next.
  1. Now you see the graph in its full glory, although it will need some sprucing up before it’s presentable. There are several things I would fix. First, the grey background shading in the graph is not only unnecessary, but consumes extra printer ink and occasionally makes it more difficult to clearly see what is on the graph. To get rid of the grey, point your cursor to some part of the grey area (not on a line). You should see a little box appear next to your cursor saying “Plot Area” as shown here (although the cursor does not show up in the screen capture):
  2. Right-click and choose, “Format Plot Area.” On the right side of the window that pops up, click on “None”. (Leave the left side of this window alone unless you want to change the properties of the border for the graph.) Click OK.
  1. Since there’s only one set of points, there’s no need to have the key (Excel calls it a “legend”) on the right side of the graph—the little box that currently shows a blue diamond labeled “ln(N)”. Click on that box to select it and touch your Delete key; it should disappear. We also don’t need the lines across the graph. Right-click on one of the lines and choose “Clear” in the box that pops up. Your graph should now look like this:
  2. There are just a couple of additional changes I often make, both relating to the axes. MS Excel generally assumes you want both axes to begin at zero. In this case, that works out fine, since our first point is (0,0); but often that’s not the case, and that assumption leaves you with a great deal of empty space, with the data points all squished up against the sides. When that occurs, we generally have a lot of unused space on one or both axes, up to the location of the first data value on the axis. It’s easy to cure that problem and other axis formatting problems. We’ll start with the y -axis. Point your cursor over the axis so that a little box appears with “Value (Y) axis” in it. Right-click and choose “Format Axis”. If you wanted to change the starting value for that axis, you would click on the Scale tab and in the Minimum box, type a value that’s at least as low as your lowest value for that axis. In this case, the 0 is fine, so I’ll leave it alone. But the value label on every whole value on the y -axis looks a little busy, so I’m going to change it to label only the even numbered values. Excel refers to the labeled values as major units , so simply change the value for “Major unit” to 2. Minor units can be marked by a tick mark without a label. It would be helpful to have that sort of indication at the odd values, so the reader can more readily interpret the locations of points in between the labeled even values. To do this, replace the default value in the “Minor unit” box with 1. Don’t click OK yet. So far, it should look like this:
  1. Now for the regression line. With your cursor, point to any one of the plotted points on the graph. Up pops a little box giving some information about the point, as you see here. (Again, for some reason, the screen capture doesn’t catch the location of the cursor, so you can’t see it in the pictures. In this case my cursor was pointing to the point that’s just above the little box.)
  2. Right-click, and you get a little pop-up menu, as shown below. Choose “Add Trendline” from the menu.
  1. We want to look at the linear relationship between y and x , so leave the “Trend/Regression type” at the default, “Linear”. Don’t close the window yet.
  2. Now click on the Options tab. Here you simply need to check the box that says “Display equation on chart” and click OK.