I. Quck-and Drty Excel Tutoral Analytcal Chemstry Calbraton Curve Handout For those of you wth lttle experence wth Excel, I ve provded some key technques that should help you use the program both for problem sets and lab wrte-ups. Please come talk wth me f you have questons about any of ths materal I ve come to love(!) Excel more and more throughout my career, and I m always happy to help people explot the program s power. I also recommend you read Harrs excellent dscussons of Excel technques. In partcular, I recommend Sectons -10 and -11 (pp. 38-4), the example on pp. 84-85, and Secton 5-5 (pp. 9-93). Much of the power of Excel comes from the use of cell references. For example, say we wanted to plot the vapor pressure of water n Torr as a functon of temperature n ºC. Let s further say I want the plot to go from 10ºC to 30ºC, wth ponts at every degree. (Ths could be useful n experments n whch we collect gases under water.) We are gven the followng emprcal equaton (called the Antone equaton ): log P = B A T + C In ths equaton, P s the vapor pressure n atm, T s the temperature n K, and A, B, and C are constants. (In the temperature range of nterest, A = 5.401, B = 1838.675, and C = -31.737.) The vapor pressure therefore depends on a contnuously changng varable, T, and on three constants. Excel s great at solvng problems lke ths! The plot s below, and the spreadsheet I used to generate the plot s on the next page. Vapor Pressure Curve 35 Pressure (Torr) 30 5 0 15 10 5 10 15 0 5 30 Temperature (deg C) Page 1 of 10
Spreadsheet Remarks Note that I have entered the formula s constants nto cells B, B3, and B4. Ths wll allow me to refer to them when I defne formulas, and to re-defne them at wll. (For example, f I wanted the vapor pressure n a dfferent temperature range, I would need to use a dfferent set of constants.) In cell C, I have entered the number 10. Instead of typng n 11, 1, 13, etc. n the cells below, I type the followng formula nto cell C3: = C+1 In ths formula, C s a relatve cell reference. What ths formula really tells cell C3 s, Take the number rght above you, and add 1 to t. I can then copy the formula n C3 nto cells C4 through C. Here are two ways to do ths: (1) Hghlght cells C3 through C, then press CTRL and D smultaneously (n Wndows) or Open-Apple and D smultaneously (on a Macntosh). These both execute the command copy down. () Clck on cell C3, and then put your cursor over the lower-rght corner of ths cell. In Wndows, the bg plus sgn should become a small plus sgn. On a Macntosh, the bg plus sgn becomes an open square. In ether case, drag down your cursor to cell C. Usng ether procedure, the desred values (11 through 30) appear lke magc! Clck on cell C. Note that the formula now reads = C1+1 Excel automatcally updates the cell reference. The message, though, s stll the same: Take the number rght above you, and add 1 to t. Ths s why the cell reference s called relatve. The formula requres that T be n K, so I make the requred unt converson n Column D. In cell D, I type n =C+73.15 and then execute the copy down procedure descrbed above. Page of 10
In Column E, I compute log P for each T n Column D. Here s the formula n cell E: =$B$-($B$3/(D+$B$4)) The dollar sgns ($) make cell references B, B3, and B4 absolute that s, they wll not be automatcally updated when we copy down n a moment. However, snce I want the log P n each row to use the temperature n that row, I make the cell reference to temperature relatve. (D n the formula really means, Use the value n the cell just to the left of you.) Copy down as usual. Clck on cell E, and note the formula present: =$B$-($B$3/(D+$B$4)) The dollar sgns ndeed lock n references to the three cells contanng constants. However, the temperature reference s updated to D. Excel can be a great tme-saver. Instead of usng your calculator to do unt conversons or other math procedures on a column of numbers, use neghborng columns n Excel to do them. For example, we need to go from the log (base 10) of vapor pressure to vapor pressure. We do that by typng nto cell F =10^E and copy down to cell F. Fnally, to convert from atm to Torr, we type nto cell G =F*760 and copy down to cell G. Now, let s generate the plot! The general approach s to hghlght the numbers to be plotted, then choose Insert Chart (usng the Insert pull-down menu). (Instead of usng the pulldown menu, you can smply press the chart button (labeled by a tr-color bar graph), f such a button s present on your tool bar.) However, note that we are requred to plot T n degrees C on the x-axs, and P n Torr on the y-axs. After selectng one set of cells, you can select another set of cells n a non-adjacent column by keepng the CTRL key (Wndows)/Open-Apple key (Macntosh) pressed down. Ths wll brng up the Chart Wzard. Choose Chart type XY (Scatter) n Step 1. Step lets you redefne whch cells are beng plotted; we ll skp that here. Step 3 lets you tend to chart appearance: addng axs labels, etc. Dong ths s requred; you should always document your charts. Step 4 lets you decde f you want to paste the chart nto your current worksheet (a good dea f you want to ft everythng on one sheet of paper when you prnt out) or on a new sheet. Note that once a chart has been created, you are free to contnue alterng ts appearance. In partcular, I hghly recommend that you double-clck on both the x-axs and the y-axs and reset the Mnmum and Maxmum values (found on the Scale tab) so that the ponts fll all avalable space on the graph (lke the plot on p. 1). In other words, don t leave your graph lke ths: P (Torr) 35 30 5 0 15 10 5 0 0 5 10 15 0 5 30 35 P (Torr) Page 3 of 10
II. Constructng a Calbraton Curve by the Method of Least Squares A. Frst Iteraton: Usng Add Trendlne After you create the above spreadsheet, select the data n Columns A and C and generate a plot (as descrbed on p. 3). Next, clck on the ponts, and do the followng: Select Add Trendlne under the Chart pull-down menu. Under the Type tab, choose a lnear Trend/Regresson Type. Under the Optons tab, choose to dsplay both the equaton and R-squared (R ) value on the chart. Clck on your trendlne box and go to Selected Data Labels n the Format pull-down menu. Under the Number tab, choose to dsplay at least three fgures for your parameters. Calbraton Curve 0.4000 Sgnal 0.3000 0.000 0.1000 y = 0.01630x + 0.00467 R = 0.99785 0.0000 0 5 10 15 0 [Proten Standards] (ug) Page 4 of 10
The correlaton coeffcent R s a good qualtatve measure of lnearty, but Page 5 of 10
B. Second Iteraton: Usng the Excel Array Functon LINEST LINEST s an example of an array functon wth four arguments. In the above spreadsheet, you would enter t as follows: Select a -column by 5-row array of cells (D0:E4 above) (Note the use of a colon to specfy a range of cells.) Type n =lnest(c3:c16,a3:a16,true,true) LINEST s frst argument s the range of cells contanng y-values. The second argument s the range of cells contanng x-values. (Excel wll complan f the number of y-values does not match the number of x-values.) The thrd argument (true or false) refers to whether we want to optmze the y-ntercept (true) or force the y-ntercept to be zero (false). The fourth argument (true or false) s askng f we want other statstcal parameters besdes m and b. Always say true for the last two arguments. (On Wndows machnes:) Press CTRL-SHIFT-ENTER smultaneously (On Macntoshes:) Press OpenApple-SHIFT-ENTER smultaneously Page 6 of 10
The above spreadsheet labels seven of the ten parameters computed by LINEST. It reports not only the least squares parameters m and b, but also the standard errors of measurement n m (that s, s m ), n b (that s, s b ), and n a readng y made on a sample (that s, s y ). Because these are standard errors of measurement (that s, standard devatons dvded by n ), you obtan 95% confdence ntervals for m, b, and y smply by multplyng s m, s b, and s y by the approprate value of Student s t for n- degrees of freedom. We lose two degrees of freedom snce we have calculated both a slope and a y-ntercept from the data. (Note that Harrs s wrong: LINEST does not report standard devatons n m, b, and y: they have already been dvded by n.) The standard error n the slope s enough nformaton n many cases (such as n Physcal Chemstry I experments), but n Analytcal Chemstry, we want to quantfy the error n x, the concentraton correspondng to a measurement y. Page 7 of 10
Page 8 of 10
C. Fnal Iteraton: Explct Evaluaton of the Least-Squares Formulas (also see spreadsheet n Harrs Fgure 5-9) Frst, compute values of x y and x for each pont, then sum up columns A, C, D, and E. Then evaluate the followng formulas (note that n s the number of ponts): = ( ) n D n x x y x y x y x y x m = b = D D Then use m and b to compute a devaton ( d = y mx b ) for each pont (Column F), and ts square ( d ) (Column G). Sum up Columns F and G. Ths equps us to compute the standard errors of measurement n a gven sgnal measurement (y), slope, and ntercept: x s y d = n n sm = x s y sb = s y D D Page 9 of 10
And the payoff: For k measurements on an unknown, we get an average sgnal y. We solve for the unknown s concentraton x. We then calculate the standard error of measurement n x thus: s y 1 nx x x x sx = + + m k D D D As before, you compute 95% confdence ntervals by multplyng s m, s b, s y, or s x by the approprate value of Student s t for n- degrees of freedom. Page 10 of 10