Skip to content

Negative exponential fit

12 messages · Indrajit Sengupta, Uwe Ligges, rch4 +3 more

#
We need help....

We are doing a project for a statistical class in and we are looking at
world record times in different running events over time. We are trying to
fit the data with a negative exponential but we just cant seem to get a
function that works properly. 
we have on our x-axis the date and on the y-axis the time(in seconds). So as
you can imagine, the times have decreased and appear to be approaching a
limit. Any ideas for a nls function that would work for us would be greatly
appreciated. 

Rob

--
View this message in context: http://r.789695.n4.nabble.com/Negative-exponential-fit-tp4117889p4117889.html
Sent from the R help mailing list archive at Nabble.com.
#
On 29.11.2011 07:06, Indrajit Sengupta wrote:
It is a contributed packages, and perhaps it is a good one (I do not 
know), but calling it the *default* ... who defined that?

Best,
Uwe Ligges
#
rch4 <rch4 <at> geneseo.edu> writes:
I disagree with the other solutions posted here: think you're looking
not for a distribution, but for the change over time.

  You could start with 

 fit1 <- lm(log(time)~I(date-date[1]))

where the intercept will be the *log* of the intercept (value on
the first date) and the slope will be the exponential coefficient.
If you need to be more careful about your statistical assumptions
(e.g. if the variance appears to be homogeneous on the original
scale but not on the log scale) then something like

  fit2 <- nls(exp(logint)*exp(-r*(date-date[1])),
       start=...)

should work.  You need to set the starting values appropriately -- the values
from the linear fit above should be pretty good.
#
Thank you for your suggestions. We are currently working with an the nls
function, but are having trouble getting a curve that fits our data. We have
tried using the following formula:

mod1 = nls(time~a*exp(b*(date)), start=list(a=4.178,b=-1.18))
av=mdate
bv=predict(mod1,list(mdate=av))
length(av)
length(bv)
lines(av,bv)

We've been trying to work with your suggestions but aren't having any luck
thus far. We've also tried to exponentiate the times in hopes they would
produce a better fit, but can't seem to produce a formula without getting
errors. 

Any further help/explanations would be appreciated. 

--
View this message in context: http://r.789695.n4.nabble.com/Negative-exponential-fit-tp4117889p4121694.html
Sent from the R help mailing list archive at Nabble.com.
#
On 30.11.2011 07:25, Indrajit Sengupta wrote:
Not that I know. Suggesting it is perfect. I'd just not call any package 
a "default" if it does not ship with R.

Best,
Uwe
#
Am 29.11.2011 07:06, schrieb Indrajit Sengupta:
I do not want to shed out any doubt as to the merits of
pkg fitdistrplus, in particular for censored data, but
seconding Uwe's reply later in this thread, you may
also want to check out pkg distrMod on CRAN ---

M. Kohl, P. Ruckdeschel (2010): R Package distrMod: S4
  Classes and Methods for Probability Models. Journal of Statistical
  Software, 35(10), 1-27. URL http://www.jstatsoft.org/v35/i10/.

which offers quite some additional flexibility for model
fitting---including "new models" (built on distributions
which "have no name" but instead are image distributions
under arithmetic transformations of existing ones, see
example M2 in the cited ref) and (nonlinear) transformations
of the parameter (see Example p.15, cited ref).

Best regards,
Peter
#
On Nov 29, 2011, at 23:19 , Ben Bolker wrote:

            
Not that this is anywhere near my areas of expertise, but wouldn't you want to be even more careful than that? I mean, surely the record time is nondecreasing, and one would expect that the time between records to carry information about the issue (e.g., in a stable situation, it should increase as a lower limit is being approached)?

  
    
#
On 11-11-30 11:32 AM, peter dalgaard wrote:
All that seems reasonable.  In addition, the lower limit is  not zero
(which my answer assumed).  However, the OP can't get a negative
exponential fit to work in the first place, so they should probably be
starting with something simple ...

  To deal with the "lower limit is not zero" problem they can just add a
parameter:

fit2 <- nls(minval+exp(logint)*exp(-r*(date-date[1])), start=...)