Re: Re: Asking NonlinearRegression
- To: mathgroup at smc.vnet.net
- Subject: [mg88815] Re: [mg88781] Re: Asking NonlinearRegression
- From: "Thomas Dowling" <thomasgdowling at gmail.com>
- Date: Sat, 17 May 2008 05:31:12 -0400 (EDT)
- References: <g0h4kd$la4$1@smc.vnet.net> <200805160933.FAA01135@smc.vnet.net>
Hello,
Are you sure about this?
Proceeding as you outlined ...
In[375]:= d1 = {1, 0.00, 2, 0.00, 3, 0.00, 4, 0.00, 5, 0.00, 6, 0.00, 7,
0.00,
8, 0.00, 9, 0.00, 10, 0.00, 11, 0.00, 12, 0.00, 13, 0.00, 14, 0.00,
15, 0.00, 16, 0.00, 17, 0.00, 18, 0.00, 19, 0.00, 20, 0.00, 21,
0.00, 22, 0.00, 23, 0.00, 24, 0.00, 25, 0.00, 26, 0.00, 27, 0.00,
28, 0.00, 29, 0.00, 30, 0.00, 31, 0.00, 32, 0.00, 33, 0.00, 34,
0.00, 35, 0.00, 36, 0.00, 37, 0.00, 38, 0.00, 39, 0.00, 40, 0.00,
42, 0.00, 44, 0.00, 46, 0.00, 48, 0.00, 50, 0.00, 52, 0.04, 54,
0.06, 56, 0.08, 58, 0.09, 60, 0.16, 65, 0.24, 70, 0.32, 75, 0.43,
80, 0.49, 85, 0.58, 90, 0.80, 95, 0.91, 100, 1.00, 105, 1};
In[376]:= fun = Exp[(1 - Exp[a*(1 - Exp[-b*x])])*(Exp[-b*x])/(1 -
Exp[-b*x])];
In[412]:= paramrules = FindFit[d1, fun, {a, b}, x]
Out[412]= {a -> 0.648266, b -> 1.02124}
If I now plot the (partitioned) data and the fitted function, as follows:
In[419]= plot = Plot[fun /. paramrules, {x, 0, 105}, AxesOrigin -> {0, 0}];
listplot = ListPlot[Partition[d1, 2], PlotRange -> {-.05, 1.1
}, PlotStyle -> {Green, PointSize[Large]}];
Show[plot, listplot]
This does not seem to be a reasonable fit to me.
Furthermore, the following gives an overflow error message. Are you sure you
are trying to fit to an appropriate function?
In[422]= FindFit[Partition[d1, 2], fun, {a, b}, x]
IGeneral::ovfl: Overflow occurred in computation. >>
General::ovfl: Overflow occurred in computation. >>
General::ovfl: Overflow occurred in computation. >>
General::stop: Further output of General::ovfl will be suppressed \
during this calculation. >>
FindFit::nrlnum: The function value <<1>> is not a list of real \
numbers with dimensions {59} at {a,b} = {-1.80801,-5.23877}.
Out[422]= {a -> -1.80801, b -> -5.23877}
I have not been able to obtain a reasonable fit to your data even using
'manual' values for 'a' and 'b' in 'fun'. Maybe fit to
a different function?
Tom Dowling
On Fri, May 16, 2008 at 10:33 AM, dh <dh at metrohm.ch> wrote:
>
>
> Hi Navri,
>
> NonlinearRegression as well as FindFit (should be used instead of the
>
> older NonlinearFit) seem to work as expected:
>
> fun=Exp[(1-Exp[a*(1-Exp[-b*x])])*(Exp[-b*x])/(1-Exp[-b*x])];
>
>
> d1={1,0.00,2,0.00,3,0.00,4,0.00,5,0.00,6,0.00,7,0.00,8,0.00,9,0.00,10,0.00,11,0.00,12,0.00,13,0.00,14,0.00,15,0.00,16,0.00,17,0.00,18,0.00,19,0.00,20,0.00,21,0.00,22,0.00,23,0.00,24,0.00,25,0.00,26,0.00,27,0.00,28,0.00,29,0.00,30,0.00,31,0.00,32,0.00,33,0.00,34,0.00,35,0.00,36,0.00,37,0.00,38,0.00,39,0.00,40,0.00,42,0.00,44,0.00,46,0.00,48,0.00,50,0.00,52,0.04,54,0.06,56,0.08,58,0.09,60,0.16,65,0.24,70,0.32,75,0.43,80,0.49,85,0.58,90,0.80,95,0.91,100,1.00,105,1};
>
> FindFit[d1,fun,{a,b},x]
>
> NonlinearRegress[d1, fun, {a, b}, x]
>
> Could it bee that you had a syntax error?
>
> hope this helps, Daniel
>
>
>
>
>
> Navri Navri Bintang wrote:
>
> > Hi,
>
> >
>
> > I have a problem with nonlinear regression in Mathematica. I want to fit
> my data (below) to this following equation:
>
> >
>
> > y = Exp[(1-Exp[a*(1-Exp[-b*x])])*(Exp[-b*x])/(1-Exp[-b*x])]
>
> >
>
> > and I would like to find a and b values and also determined r-squared
> value.
>
> >
>
> > I try to use NonlinearRegression/NonlinearFit code, but its not working,
> I hope someone could help me
>
> >
>
> > Thanks a lot
>
> >
>
> > DATA:
>
> > x y
>
> > 1 0.00
>
> > 2 0.00
>
> > 3 0.00
>
> > 4 0.00
>
> > 5 0.00
>
> > 6 0.00
>
> > 7 0.00
>
> > 8 0.00
>
> > 9 0.00
>
> > 10 0.00
>
> > 11 0.00
>
> > 12 0.00
>
> > 13 0.00
>
> > 14 0.00
>
> > 15 0.00
>
> > 16 0.00
>
> > 17 0.00
>
> > 18 0.00
>
> > 19 0.00
>
> > 20 0.00
>
> > 21 0.00
>
> > 22 0.00
>
> > 23 0.00
>
> > 24 0.00
>
> > 25 0.00
>
> > 26 0.00
>
> > 27 0.00
>
> > 28 0.00
>
> > 29 0.00
>
> > 30 0.00
>
> > 31 0.00
>
> > 32 0.00
>
> > 33 0.00
>
> > 34 0.00
>
> > 35 0.00
>
> > 36 0.00
>
> > 37 0.00
>
> > 38 0.00
>
> > 39 0.00
>
> > 40 0.00
>
> > 42 0.00
>
> > 44 0.00
>
> > 46 0.00
>
> > 48 0.00
>
> > 50 0.00
>
> > 52 0.04
>
> > 54 0.06
>
> > 56 0.08
>
> > 58 0.09
>
> > 60 0.16
>
> > 65 0.24
>
> > 70 0.32
>
> > 75 0.43
>
> > 80 0.49
>
> > 85 0.58
>
> > 90 0.80
>
> > 95 0.91
>
> > 100 1.00
>
> > 105 1
>
> >
>
> >
>
> > Rgds,
>
> > Navri
>
> >
>
> >
>
> >
>
> >
>
> >
>
>
- References:
- Re: Asking NonlinearRegression
- From: dh <dh@metrohm.ch>
- Re: Asking NonlinearRegression