Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Regression with different results.



Dr. Donald E. Simanek Internet: dsimanek@eagle.lhup.edu writes:

A colleague from chemistry brought to my attention an interesting difference
in the performance of Microsoft Excel in its Mac and DOS versions. Her
students were doing a chemistry problem requiring a data set of about 8
points on which a linear regression was to be done. Our students use both
Mac and DOS platforms, and our student labs have both. Excel is on both.
Students got the same answer for the slope of the line, a, but vastly
different results for the intercept, b. (y = ax + b).
....
the two versions seem to be using
different algorithms for the calculation, and one is faulty.
My Mathcad manual not only documents the algorithms used, but gives
references to the literature for each.
....
My hunch is that the difference is in the software and has nothing to do
with the relative merits of the hardware. One can, of course, simply wave
it away, saying that the difference is insignificant, and the intercept is
practically zero (as theory would predict in this case). And another pet
peeve. In a case such as this, where there's overpowering reason to say
that the fit must pass exactly through zero, there's no graceful way to
tell the commercial software this, forcing a fit through zero. Or maybe I
just don't know the trick to do it, since I never use Excel, Quattro, or
any of the other spreadsheet clones.

I'd like to make a couple of points:

First my pet peeve is software (spreadsheets, HP calculators, etc.) which
perform a regression and then do not provide the error in the coefficients. I
would like to know how the experimental errors affect the slope and intercept
which are calculated.

I've modified my HP 28S and Quattro Pro spreadsheets to provide these numbers.
When dealing with experimental data with an interest in slope and intercept, I
want to know how good these values are. Agreement to 15 digits may be
comforting, but if the results are only good to 3 or 4 digits, it appears to me
that arguing over the last 4 digits becomes more philosophical than real.

Second, I am not a fan of forcing the intercept through zero. In chemistry we
frequently have the occasion to use Beer's law to determine concentrations in
solution. Beer's law predicts Absorbance = constant X concentration. This is
reasonable since when there is no concentration, there should be no Absorbance.
Still, I think it is wrong to force the line through zero and teach students
NOT to do it. Often there are non-linearities that occur in different
concentration regions due to the chemistry of the system. I think it is better
to let the line fall where it will and use the small intercept to more
faithfully represent the calibration line.

This latter point becomes academic IF the error in the intercept is larger than
the intercept. That is the reason I force my tools to tell me the standard
deviation in both slope and intercept. I then worry less about differences in
later digits due to algorithm used. I also use Mathcad and appreciate the
documentation they provide to their algorithms.

Ciao,














I also tried a polynomial fitting routine, which gave the same results.
Try it yourself with your favorite software:

x y

0.002 0.000
0.117 0.025
0.238 0.050
0.356 0.075
0.472 0.100
0.597 0.125

IBM Excel gives a = 4.751429, b = 0.0050502
MAC Excel gives a = 4.7514 , b = -0.0002

The students obviously had different precision settings. Unfortunately
this software doesn't (so far as I know) readily compute the uncertainties
in a and b, which, in this case, will be quite large for b.


-- Donald

.....................................................................
Lock Haven University, Lock Haven, PA. 17745 CIS: 73147,2166
Home page: http://www.lhup.edu/~dsimanek FAX: 717-893-2047
.....................................................................

:-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-)
:-) :-)
:-) Frank M. Lanzafame Department of Chemistry :-)
:-) Monroe Community College 1000 East Henrietta Rd. :-)
:-) Rochester, NY 14623 (716) 292-2396 :-)
:-) Internet: flanzafame@monroecc.edu :-)
:-) :-)
:-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-):-)