Re: exponential regression
- To: mathgroup at smc.vnet.net
- Subject: [mg129674] Re: exponential regression
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 3 Feb 2013 20:21:56 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
On 2/3/13 at 2:45 AM, r.aufmann at gmail.com wrote: >I entered Clear[a, b, x]; FindFit[{{1, 4.5}, {3, 14.0}, {5, 28.6}, >{7, 54.1}, {8, 78.6}}, a*b^x, {a, b}, x] as a text of exponential >regression. The input returned {a->4.66625, b->1.42272} >Fine. However, a student of mine entered the same data in a TI-84 >calculator and it returned 3.947506 (x^1.334589). These two >equations are obviously not the same. Does anyone know why there is >a discrepancy? The TI calculator is transforming the expression to a linear expression using logarithms then doing the fitting. Mathematica is not doing that transform. You can have Mathematica use a logarithmic transform and get the same result as the TI-84 as follows: In[19]:= FindFit[{{1, 4.5}, {3, 14.0}, {5, 28.6}, {7, 54.1}, {8, 78.6}} /. {a_?NumericQ, b_} :> {a, Log[b]}, Log[a] + b Log[x], {a, b}, x] Out[19]= {a->3.94751,b->1.33459} >By the way, I tested a data set that is exactly >exponential. FindFit and the TI-84 returned exactly the same >equation. Right. The difference is what happens to the error term. With exact exponential data the error term is zero and the transform has no effect on the regression coefficients. But with a non-zero error term what you are computing is Log[y + error] and the fitting routine is using linear regression which means it is assuming a model such as y + error = a x + b If the error term is multiplicative rather than additive, the transformed problem would be preferred as it would be closer to the maximum likelihood estimate. For additive errors, the maximum likelihood estimate is given by the Mathematica result using the original data with no transform.