[R] non-linear curve fitting

Hufkens Koen koen.hufkens at ua.ac.be
Fri Mar 23 10:33:11 CET 2007


I'll give you the equation of the reference I based my thinking upon.

this the link:  http://users.pandora.be/requested/images/equation.png

It's a sigmoid error function, but I thought I simplified things by picking a less complex form, although I think It won't matter that much.

Anyway, as Ted suggested, this equation has the terms reparameterised into the form -(bx+c) as well. In my reference they probably tested for the b=0 scenario because they had an F-statistic. But to be honest I wouldn't know how to start implementing this? It seems a little more complicated then the ordinary stuff I normally do.

Koen


> -----Original Message-----
> From: ecatchpole [mailto:e.catchpole at adfa.edu.au] 
> Sent: donderdag 22 maart 2007 23:25
> To: Douglas Bates
> Cc: Hufkens Koen; r-help at stat.math.ethz.ch; Philippe Grosjean
> Subject: Re: [R] non-linear curve fitting
> 
> Douglas Bates wrote on 03/23/2007 06:16 AM:
> > On 3/22/07, Hufkens Koen <koen.hufkens at ua.ac.be> wrote:
> >   
> >> Is there a means of getting an F-statistic (p-value) out 
> of all of this.
> >>     
> >
> >   
> >> Because least-square criterion / r-square only tell me how 
> good the fit is and not necessarily how solid this fit is. An 
> F-statistic (p-value) would be nice...
> >>     
> >
> > What would the F-statistic be?  For a linear model with an 
> intercept 
> > the F-statistic represents a comparison of the model that 
> you have fit 
> > to the trivial model (intercept only).  It is important that the 
> > models being compared are nested - otherwise the F statistic is of 
> > questionable validity.
> >
> > For the logistic growth model you described (which is not quite the 
> > one fit by SSlogis - that model has one more parameter, a 
> scale factor 
> > on the response) the response always goes to zero as x -> 
> -\Infty and 
> > to one as x -> \Infty.  The trivial model is not nested within this 
> > model for finite parameter values so I'm not sure what hypotheses 
> > would be tested by an F-statistic.
> >   
> 
> If the original curve is reparameterised as f(x) = 
> 1/(1+exp(-(a+b*x))), then you can test whether b=0.  Is this any help?
> 
> Ted.
> >   
> >> Regards,
> >> Koen
> >>
> >>
> >>     
> >>> -----Original Message-----
> >>> From: Philippe Grosjean [mailto:phgrosjean at sciviews.org]
> >>> Sent: donderdag 22 maart 2007 14:02
> >>> To: Hufkens Koen; r-help at stat.math.ethz.ch
> >>> Subject: Re: [R] non-linear curve fitting
> >>>
> >>> Hello,
> >>>
> >>> If a least-square criterion is fine for you, you should 
> use nls(). 
> >>> For the logistic curve, you have a convenient self-starting model 
> >>> available:
> >>> SSlogis(). Look at:
> >>>
> >>> ?nls
> >>> ?SSlogis
> >>>
> >>> Best,
> >>>
> >>> Philippe Grosjean
> >>>
> >>> ..............................................<°}))><........
> >>>   ) ) ) ) )
> >>> ( ( ( ( (    Prof. Philippe Grosjean
> >>>   ) ) ) ) )
> >>> ( ( ( ( (    Numerical Ecology of Aquatic Systems
> >>>   ) ) ) ) )   Mons-Hainaut University, Belgium
> >>> ( ( ( ( (
> >>> ..............................................................
> >>>
> >>> Hufkens Koen wrote:
> >>>       
> >>>> Hi list,
> >>>>
> >>>> I have a little curve fitting problem.
> >>>>
> >>>> I would like to fit a sigmoid curve to my data using the
> >>>>         
> >>> following equation:
> >>>       
> >>>> f(x) = 1/(1 + exp(-(x-c)*b)) (or any other form for that matter)
> >>>>
> >>>> Where x is the distance/location within the dataframe, c is
> >>>>         
> >>> the shift of the curve across the dataframe and b is the 
> steepness 
> >>> of the curve.
> >>>       
> >>>> I've been playing with glm() and glm.fit() but without any luck.
> >>>>
> >>>> for example the most simple example
> >>>>
> >>>> x = -10:10
> >>>> y = 1/(1 + exp(-x))
> >>>> glm(y ~ x, family=binomial(link="logit"))
> >>>>
> >>>> I get a warning:
> >>>> non-integer #successes in a binomial glm! in: eval(expr, envir,
> >>>> enclos)
> >>>>
> >>>> and some erratic results
> >>>>
> >>>> This is the most simple test to see if I could fit a curve
> >>>>         
> >>> to this perfect data so since this didn't work out, 
> bringing in the 
> >>> extra parameters is a whole other ballgame so could 
> someone give me 
> >>> a clue?
> >>>       
> >>>> Kind regards,
> >>>> Koen
> >>>>
> >>>>
> >>>>         
> >
> 
> 
> --
>  Dr E.A. Catchpole
>  Visiting Fellow
>  Univ of New South Wales at ADFA, Canberra, Australia
>     _	  and University of Kent, Canterbury, England
>    'v'	  - www.pems.adfa.edu.au/~ecatchpole          
>   /   \	  - fax: +61 2 6268 8786		   
>    m m    - ph:  +61 2 6268 8895             
> 
> 
> 
> 
> 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.16/729 - Release 
> Date: 21/03/2007 7:52
>  
> 

--



More information about the R-help mailing list