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.
What have you tried so far - can you explain? "fitdistrplus" package is the default package for fitting distributions. Regards, Indrajit ________________________________ From: rch4 <rch4@geneseo.edu> To: r-help@r-project.org Sent: Tuesday, November 29, 2011 8:39 AM Subject: [R] Negative exponential fit 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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
On 29.11.2011 07:06, Indrajit Sengupta wrote:> What have you tried so far - can you explain? "fitdistrplus" package is the default package for fitting distributions.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> > Regards, > Indrajit > > > > ________________________________ > From: rch4<rch4 at geneseo.edu> > To: r-help at r-project.org > Sent: Tuesday, November 29, 2011 8:39 AM > Subject: [R] Negative exponential fit > > 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. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
rch4 <rch4 <at> geneseo.edu> writes:> > 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. > > RobI 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.