Graphing and Curve Fitting
To graph data in Excel, enter your data one variable per column in consecutive columns. Highlight the data you wish to graph and then choose Chart... from the Insert menu. This brings up the Chart Wizard. There are many graph formats to choose from; once you choose one, the wizard will walk you through customizing your graph. Here is an example of bar charts.
A few items to note while working through the chart wizard:
Most scientific graphs show the relationship between two quantities. In Excel, such a relationship is graphed using a scatter plot. Use a blank sheet by clicking on a Sheet at the bottom. Type in the independent (x) and dependent variables (y) in adjacent columns; Excel will assume that the left column is intended for the horizontal axis. Graph a scatter plot of these points by highlighting the data and then clicking on the chart wizard Be sure to choose scatter plot and not line graph. Line graphs assume that the horizontal axis should be marked with counting numbers (1, 2, 3, etc.) and that each highlighted column is a separate set of vertical axis coordinates.
Read the directions in the wizard to customize your graph. After you have done all of the steps, you should see a plot of your data.
Often scientists look at scatter plots like the one above to determine the trend of the data by finding a function that fits the data well. Excel has Least Squares Regression routines built in for the most common behaviors: linear, polynomial, exponential, power, logarithmic.
To fit a curve to the data in the chart above, first graph it as a scatter plot. Now you are ready to add a fit. Click once on any part of the chart, and then choose Add Trendline from the Chart menu. You will be asked what kind of trend. Also set the options so that the formula for the fit and the r-squared value are printed on the graph if desired.
The curve will appear on the graph along with the data.
As always, you should use caution when interpreting the r-squared value. Mathematically this value must increase for “curvier” functions such as polynomials of higher degree. Choosing between different functions should be done visually, not relying solely on the r-squared value.
Lab Activity 2:For the following questions, write your answers to all four questions in a file and e-mail me the file at the end. Or write your answeres in the body of your e-mail and send me the e-mail.
(graphing 1) Use linear regression to find a formula relating the amount of the speciman to the output from the gas chromatograph in the dataset.
(graphing 2) The inverse of Hubble’s constant can be used as an estimate of the time since the big bang. Use the data to fit a curve to find Hubble’s constant (note that the relationship has no intercept).
(graphing 3) Investigate Gompertz’ law for population growth.
(graphing 4) Investigate the relationship between mortality from breast cancer and average annual temperature..
note that the last one is always constant because it is not time-dependent.