Using Excel for Linear Regression Calculations
Using Excel for Linear Regression Calculations
Using Excel for Linear Regression Calculations
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chemistry 215<br />
<strong>Using</strong> <strong>Excel</strong> <strong>for</strong> <strong>Linear</strong> <strong>Regression</strong> <strong>Calculations</strong><br />
<strong>Excel</strong> contains several functions allow you to find the slope, intercept, and R 2 (the square of the correlation<br />
coefficient) <strong>for</strong> a graph. The functions are named SLOPE(), INTERCEPT(), and RSQ(). The following example shows<br />
how these functions are used<br />
Example – Calibration Curve<br />
The analysis of ethanol in wine by gas chromatography gave the following results:<br />
Standard<br />
(vol %) Peak Area<br />
Blank 11.4<br />
4.99 1240.3<br />
9.98 2489.1<br />
14.97 3741.4<br />
20.96 4976.0<br />
Sample 2849.7<br />
Find:<br />
• The slope (m), intercept (b), and square of the correlation coeff. (R 2 )<br />
• The concentration of ethanol in the sample<br />
First, enter the data in columns A and B. You may or may not wish to enter the column headings; in this example<br />
column headings will be included.<br />
Figure 1<br />
Next, in column C correct <strong>for</strong> the blank. To do this, subtract the<br />
blank value from each of the standards and the sample. Enter<br />
the <strong>for</strong>mula “=B2‐B$2” in cell C2 and double‐click on the small<br />
box in the lower right and corner of cell C2 to copy the <strong>for</strong>mula<br />
to cells C3 through C7. (Recall from the <strong>Excel</strong> tutorial that the<br />
“$” character prevents a reference from being updated when<br />
you copy the <strong>for</strong>mula. In this case the data in row 2 – i.e. the<br />
blank reading – is subtracted from each standard and the<br />
sample.) Your spreadsheet should now look something like<br />
Figure 1.<br />
Type labels <strong>for</strong> the slope, intercept, and R 2 in cells A9‐A11. In<br />
cell B9, type “=slope(”. You should see <strong>Excel</strong>’s function help<br />
pop up by the cursor (Figure 2). This is useful <strong>for</strong> reminding<br />
you what arguments the function requires. Note that the y<br />
values are to be entered first, followed by the x values. Also, if<br />
you need further help, click on the name of the function to get<br />
a more thorough description of the function. To enter the data<br />
range, either type “A3:A6” or highlight the y values with your<br />
cursor. Next, type a comma and then highlight or type in the x<br />
range.<br />
Figure 2
Figure 3 shows what the screen should look like after entering the x and y ranges. Note that the ranges are colorcoded.<br />
Press ENTER to calculate the slope. (Typing the closing parenthesis is optional; <strong>Excel</strong> will assume you want<br />
to close the parenthesis if you don’t type it.) Repeat this procedure <strong>for</strong> the intercept and R 2 . These functions are<br />
INTERCEPT() and RSQ(), respectively, and both require that you enter the y range first. At this point you may wish<br />
to adjust the number of decimal points in each cell.<br />
The screen should now resemble Figure 4.<br />
Figure 3<br />
Figure 4<br />
Finally, compute the concentration of the unknown by entering “=(C7‐B10)/B9” in cell D7 (Figure 5). Adjust the<br />
number of decimal places as necessary.<br />
Final Result!<br />
Figure 5