Docsity

Linear Regression and Graphing: A Tutorial on Excel 2000 for Chemistry Students, Study notes of Electrodynamics

Toggle sidebar
bg1
Linear Regression and Graphing
http://www.usna.edu/ChemDept/plebeChem/excel_tutor/xlstut3.htm[8/16/2013 3:32:57 PM]
Trendlines and Graphing
By Joseph F. Lomax, with the assistance of ENS Lora Anderson, revised from the tutorial by
Wayne Pearson and John Schultz: all of the Chemistry Department, USNA.
Part III: An Exercise in Trendlines and Graphing
Table of Content
1. First, a Warning.
2. Let's Get Started.
3. Here goes.
4. The Significance of the Data?
5. There is a Plot to this Story.
6. What to do?
7. Your Pocket or Graphing Calculator has it!
8. The Version in Excel is a Breeze.
9. Let's Do It!
10. Caveat Computor
11. But What Does It Mean?
12. XY Pairs have a Meaningful Relationship.
13. A Cause for a Celebration?
14. An Additional Exercise or Two or Three
1. First, a Warning.
To do this exercise you must be sitting in front of a computer with the application Excel 2000 running. This
write-up is not intended to be a keystroke-by-keystroke or mouse-click to mouse-click instruction set. The
assumption is that you have gone through the Getting Started and the Further Adventures in Excel 2000
tutorials that are on the Excel 2000 Tutorial Homepage. If you have not done these, do so now. Otherwise
let us proceed onward. Note: If you wish to print out this Web file, make sure that you format your
printer to print in landscape mode!!!
2. Let's Get Started.
Keep in mind that Excel 2000 is a highly redundant system. There are at least two ways, and maybe more,
to do the same thing. Larry Wall, the inventor of the programming language PERL, describes this
redundancy as TIMTOWTDI (There Is More Than One Way To Do It). This is pronounced .... oh, pronounce
it any way you want, because TIMTOWTDI. Your way of accomplishing a task need not match exactly what
is describe below and that is OK. The goal is to discover the physical relationship described by the data, not
to get a notebook page and graph that match in every way what are in the images below.
3. Here goes.
Copy into the book, sheet 1 the 6-pairs of xy data shown in the table below.
pf3
pf4
pf5

Partial preview of the text

Download Linear Regression and Graphing: A Tutorial on Excel 2000 for Chemistry Students and more Study notes Electrodynamics in PDF only on Docsity!

Trendlines and Graphing

By Joseph F. Lomax, with the assistance of ENS Lora Anderson, revised from the tutorial by

Wayne Pearson and John Schultz: all of the Chemistry Department, USNA.

Part III: An Exercise in Trendlines and Graphing

Table of Content

  1. First, a Warning.
  2. Let's Get Started.
  3. Here goes.
  4. The Significance of the Data?
  5. There is a Plot to this Story.
  6. What to do?
  7. Your Pocket or Graphing Calculator has it!
  8. The Version in Excel is a Breeze.
  9. Let's Do It!
  10. Caveat Computor
  11. But What Does It Mean?
  12. XY Pairs have a Meaningful Relationship.
  13. A Cause for a Celebration?
  14. An Additional Exercise or Two or Three

1. First, a Warning.

To do this exercise you must be sitting in front of a computer with the application Excel 2000 running. This write-up is not intended to be a keystroke-by-keystroke or mouse-click to mouse-click instruction set. The assumption is that you have gone through the Getting Started and the Further Adventures in Excel 2000 tutorials that are on the Excel 2000 Tutorial Homepage. If you have not done these, do so now. Otherwise let us proceed onward. Note: If you wish to print out this Web file, make sure that you format your printer to print in landscape mode!!!

2. Let's Get Started.

Keep in mind that Excel 2000 is a highly redundant system. There are at least two ways, and maybe more, to do the same thing. Larry Wall, the inventor of the programming language PERL, describes this redundancy as TIMTOWTDI (There Is More Than One Way To Do It). This is pronounced .... oh, pronounce it any way you want, because TIMTOWTDI. Your way of accomplishing a task need not match exactly what is describe below and that is OK. The goal is to discover the physical relationship described by the data, not to get a notebook page and graph that match in every way what are in the images below.

3. Here goes.

Copy into the book, sheet 1 the 6-pairs of xy data shown in the table below.

X Y

Time Distance 14.8 9. 17.2 20. 20.7 25. 21.6 30. 25.7 41. 28.7 60.

I will use the A and B columns for the raw data, you can, too. Then try to generate the graph by highlighting the cells with data for the dependant variable, Distance. Place your cursor over the set dependant variable data cells and SELECT the Chart Wizard icon at the top of your screen. If you need a further reminder on how to make a graph, take this link to Exercise 7: Making a Chart (a.k.a. Graph) in Excel from Excel 2000 Getting Started. See if you can make your graph look as much like the image below as possible, including the text (obviously, change the name).

If you end up with a strange looking graph, you may need to change the graph type. To do this you need to activate the Chart Wizard graph window and have the mouse cursor over the graph. Be sure to choose XY,Scatter , and not Line graph. These two graph types are not identical! Your markers for the plotted points should be either open squares or open circles, with no lines connecting the points. To change the marker style and remove any connecting lines, place the mouse cursor on one of the plotted points and click on the right mouse button. You should go to the bottom of the pop-up menu to Format Data Series. You may want to explore the menus a bit to see what is available.

Now that you have a trendline, you need a display of the data for that trendline. To do this, right click on the trendline and SELECT Format Trendline. Once you are in this window SELECT the Options tab. At the bottom, check both "display equation on chart" and "display R-squared value on chart". SELECT OK. Note: the data will automatically appear over your chart. It is difficult to read the data. So, click on the data, hold down the mouse button and move it to the right-above the "Series1" la bel. There, I like that! You could have put it anywhere on the chart window, but I like it there. It is a good idea to save your file at this point so you won't lose anything if your roommate trips over the cord that connects your computer to the electrical outlet!

10. Caveat Computor

Excel's linear regression function will do exactly what you tell it. But you must tell it the right things. Independent means x-values, the ones you plot along the horizontal axis. Dependent means y values, the ones you plot on the vertical axis. If you screw up this convention, you will get an extremely wrong result! No mercy here. Except for the formatting of the numbers, your regression output should match that in the next image. If not, check to make sure you are adhering to the conventions. One more item, the y-intercept can be forced to go through zero, or the non-zero value can be computed. In general, you will want to do the latter and compute the value of the y-intercept. This is the default setting in the regression menu, so you usually do not need to do anything here, unless you diddled with the default settings.

11. But What Does It Mean?

Taking the generic equation of a straight line to be y = Ax + B , the A value (slope) is the 3.4097. The B value (y-intercept) is -41.972. Excel's linear regression function has given us the R-squared value. The closer this number is to 1, the better the fit of the line. Though we won't be using this number that is close to 1 gives us some comfort. In most cases, the slope will be the quantity sought for, but sometimes we will be interested in the y or x-intercept as well. The x-intercept is obtained by solving the above equation for x and setting y to zero. This gives -B/A as the x-intercept.

12. XY Pairs have a Meaningful Relationship.

Now you will generate a second series of y values that correspond to the slope and intercept that the Linear

13. A Cause for a Celebration?

You spreadsheet should look something like the one in image above. If it does then Congrats -- You Made it! If it doesn't, and you can't figure out what's wrong, then Seek Help from your instructor or by going to the Chemistry Resource Room, Michelson 114, for help. In any case, save your notebook for a final time.

14. An Additional Exercise or Two or Three

  1. Modify your graph to extrapolate the straight line to the x-axis! You will be required to do this in a future chemistry lab experiment report. Right click on the trendline and change "Prediction-Backward" until the line hits the x-axis
  2. Starting with the graph in Exercise 1, extrapolate the straight line just a little bit so that it overshoots the highest experimental x-value by a small amount. Adjust the x-axis and y-axis scales so that the upper end of the straight line does not touch the graph boundaries. You may need to use manual rather than automatic scaling to get this accomplished. This enhances the appearance of the graph and is commonly done for publication in technical journals!
  3. Suppose you mess up and interchange your x and y-values when doing this exercise. What is the relationship of the incorrect slope to the correct slope? How are the incorrect x and y-intercepts related to the correct x and y- intercepts?

Return to the Excel Tutorial Homepage.

This page was last revised on 21 July 1999.