1

Click here to load reader

A Method of Visual Interactive Regression

Embed Size (px)

Citation preview

Page 1: A Method of Visual Interactive Regression

Information • Textbooks • Media • Resources

1884 Journal of Chemical Education • Vol. 83 No. 12 December 2006 • www.JCE.DivCHED.org

JCE WebWare: Web-Based Learning Aidsedited by

William F. ColemanWellesley College

Wellesley, MA 02481

Edward W. FedoskyUniversity of Wisconsin–Madison

Madison, WI 53715

A Method of Visual Interactive Regression

by Michelle S. Kim, Stanford University, Palo Alto, CA94309; Maureen Burkart and Myung-Hoon Kim*,Science Department, Georgia Perimeter College–Dunwoody Campus, Dunwoody, GA 30338;[email protected]: Analytical Chemistry; First-Year Undergraduate/General; Computer-Based Learning; Chemometrics

Requires Microsoft Excel, with Analysis ToolPak installed

It is often necessary in general chemistry courses for stu-dents to find the best-fitting line through a set of scattereddata. The method of least squares is routinely used as the sta-tistical tool to accomplish this. However, the process behindthe least-squares method, minimizing the sum of the devia-tions squared, is not clear to beginning students. Blind useof the analytical formulas for a slope and a y-intercept is notpedagogically effective, and it does not satisfy analyticallyminded students. With this in mind, we have made the pro-cess of minimizing the sum visible by allowing the individualto adjust heights in a bar graph, thus making the process moreinteractive and dynamic. The interactive feature of Excelspreadsheet programs (1) is utilized; use of the spinner bar(2) is particularly helpful.

The visualization process requires the following steps.Students prepare a table of X–Y data in an Excel worksheetand introduce another column to generate theoretical Y val-ues (Ycalc) with estimated arbitrary values of slope and inter-cept. The deviations squared and their sum are calculated inan additional column. The experimental Y and theoretical Yvalues are plotted against X in an Excel graph. Another graphin a separate chart is prepared to represent each of the devia-tions squared and their sum (SSQ, the last bar) in bar graphform. Finally, two spinner bars (2) are prepared in order tocontrol the slope and intercept for Ycalc. At this point, stu-dents may click on the spinner bar for slope until the heightfor the sum of the squares (the last bar) no longer decreases.They do the same using the intercept spinner. Then, theyalternate back and forth between the slope spinner and in-tercept spinner to repeat the steps until SSQ is minimized.

This process was developed using data and results fromBeer–Lambert law experiments. Sample calculations and graphsare summarized in Figure 1. The first two columns at the topof the figure are for the original X–Y data. The next three col-umns are for the calculated Y values (with arbitrary slope andintercept), deviations between the Y values, and deviationssquared. The last three columns are for the calculated Y val-ues, deviations, and deviations squared after minimization iscomplete. The last (and highest) bar in each bar graph repre-sents the sum of deviations squared (SSQ); its value is alsodisplayed under the bar graphs. The slope and intercept are

incremented and decremented by 0.01 and 0.001, respectively.Since the spinner control for a cell value requires an integerincrement, the base value has to be scaled with scaling factorsof 0.01 and 0.001 for a fractional increment. In order to al-low negative values in the intercept, 50 must be subtractedfrom the base value for the intercept. Ten trials were made withvarious starting values of slope and intercept, and the resultsare either equal to or very close to those calculated from theanalytical formulas, 3.99 for slope and 0.014 for intercept.

It should be noted that the results can be slightly differ-ent depending upon whether the slope or intercept is mini-mized first and upon the whims of clicking order on thespinner during the minimization. In seven out of ten trials,the method was able to find the global minimum. Only threetrials yielded a local minimum that is close to the global mini-mum. Overall, the method was successful in yielding identicalresults to the analytical formulas for the slope and the intercept.

Literature Cited

1. Coleman, W. F. Home Page. http://www.wellesley.edu/Chemis-try/colemanw.html (accessed Oct 2006); see Course and OtherWeb pages for links to a statistics site and interactive spread-sheets.

2. Coleman, W. F. Building Interactive Spreadsheets Page. http://www.wellesley.edu/Chemistry/Flick/chem231/excelforms1.htm(accessed Oct 2006) for the usage of a Spinner Bar.

Figure 1. Visual Interactive Regression. By clicking on the two spin-ner bars at the bottom of the screen display, a student can minimizethe sum of the squares of the deviations, which are shown in the bargraphs at the lower right.