PHYS-162 LAB NEBRASKA WESLEYAN UNIVERSITY SPRING 2010 - 2011 PLOTTING AND LINEAR FITTING EXPERIMENTAL DATA WITH STATISTICAL ERROR USING EXCEL PLOTTING AND ADDING FIT LINE 1. 2. 3. 4. Select the data to be plotted, then select Insert -> Chart… (or click the Chart Wizard button). Select Chart Type XY (Scatter), and Chart Sub-type points only (no lines). Click Finish. Note: Click the chart, then select from the Chart menu to change chart attributes, as desired. Equivalently, right click on the various parts of the chart to access attribute dialogs. Do not set axis scale attributes until a fit line has been added (see below). Right click on the data points themselves, then select Add Trendline… Select Linear Type, then click Options. Within Options, check Display equation on chart, and forcast the data backward and forward so that the fit line crosses the entire graph. Click OK. Note: At this time, axis scale attributes may be set or reset, because the addition of a forecasted fit line can override existing settings. Graph is as shown in the figure at the bottom of the next page. USING THE LINEST CELL FORMULA The LINEST cell formula is an array formula, which means that it returns a value into a range of cells, not just one cell. LINEST returns fit parameter data as well as statistical error data regarding the fit to a set of data. This is important because we not only want to know what the fit values are, but also their uncertainties, so that we can judge the success level of an experimental outcome: “Do we agree with the accepted value or not?”, etc. 5. Identify a 2 2 range of cells near (for instance below) your data columns. Label the first column SLOPE and the second column INTERCEPT. Label the first row VALUE and the second row STD ERROR, as shown in the accompanying figure. Dean Sieglaff Created: 13 March 2007 Modified: 13 Jan 2011 1 PHYS-162 LAB NEBRASKA WESLEYAN UNIVERSITY SPRING 2010 - 2011 Select the 2 2 range of cells just labeled in the previous step. Click in the formula bar and type =linest(. The formula argument list will appear, helping to prompt you. Also, the function name LINEST is a hyperlink to Excel help, which details the formula’s arguments and outputs. 7. Click and drag-select the y data , then type a comma. This completes entry of the first argument. 8. Click and drag-select the x data , then type a comma. This completes entry of the second argument. 9. Type “TRUE” for the third argument, then type a comma. A “FALSE” value would constrain the intercept to be zero. 10. Type “TRUE” for the fourth argument, then type ), BUT DO NOT HIT ENTER YET. This prompts LINEST to provide the standard error values. See the accompanying figure for an example of LINEST formula entry. 6. 11. The next keystroke sequence may be one of the most closely guarded secrets in Excel: Hit CTRL + SHIFT + ENTER. This prompts the LINEST formula to return in the range of selected cells. The result (with proper formatting) is as shown in the accompanying figure. Note: If Enter is inadvertently struck, simply reselect the 2 2 range of cells and hit CTRL + SHIFT + ENTER. Dean Sieglaff Created: 13 March 2007 Modified: 13 Jan 2011 2