Re: exponential regression
- To: mathgroup at smc.vnet.net
- Subject: [mg129668] Re: exponential regression
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sun, 3 Feb 2013 20:19: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
- References: <20130203074543.780E568A2@smc.vnet.net>
I do not have a TI calculator so I cannot check; however, it appears
that the calculator was given (or defaults to) a different model:
a*x^b vice a*b^x. Although even with this other model, Mathematica
comes up with different results than what you indicate came from the
calculator.
data = {{1, 4.5}, {3, 14.0}, {5, 28.6}, {7, 54.1}, {8, 78.6}} //
Rationalize;
f1[x_] = a*b^x /. FindFit[data,
a*b^x, {a, b}, x]
4.666254411839531*1.4227203453064998^x
f2[x_] = a*x^b /. FindFit[data,
a*x^b, {a, b}, x]
1.17537380064539*x^2.0035258937349667
There does not appear to be a locally optimal fit ("In the nonlinear
case, [FindFit] finds in general only a locally optimal fit") near the
reported results irrespective of the method used.
FindFit[data,
a*x^b, {{a, 3.947506}, {b, 1.334589}}, x,
WorkingPrecision -> 16,
Method -> #] & /@ {
Automatic,
"ConjugateGradient",
"Gradient",
"LevenbergMarquardt",
"Newton",
"NMinimize",
"QuasiNewton"}
{{a -> 1.175373799417422, b -> 2.003525894261809}, {a -> 1.175373793803054,
b -> 2.003525896660905}, {a -> 1.175373798908934,
b -> 2.003525894474658}, {a -> 1.175373799417422,
b -> 2.003525894261809}, {a -> 1.175373798541258,
b -> 2.003525894637715}, {a -> 1.17538,
b -> 2.00352}, {a -> 1.175373798541583, b -> 2.003525894637293}}
Plot[
Evaluate[{
Tooltip[f1[x], f1],
Tooltip[f2[x], f2]}],
{x, 0, 9},
Epilog ->
{Red, AbsolutePointSize -> 3, Point[data]}]
Bob Hanlon
On Sun, Feb 3, 2013 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. Th=
e input returned {a->4.66625, b->1.42272}
>
> Fine. However, a student of mine entered the same data in a TI-84 calcul=
ator and it returned 3.947506 (x^1.334589). These two equations are obviou=
sly not the same. Does anyone know why there is a discrepancy? By the way=
, I tested a data set that is exactly exponential. FindFit and the TI-84 re=
turned exactly the same equation.
>
> Thanks for any insight.
>
- References:
- exponential regression
- From: r.aufmann@gmail.com
- exponential regression