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.
Negative exponential fit
12 messages · Indrajit Sengupta, Uwe Ligges, rch4 +3 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111128/8ec2d8d6/attachment.pl>
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. Rob
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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111129/711bd906/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111129/23b2318d/attachment.pl>
On 30.11.2011 07:25, Indrajit Sengupta wrote:
Agreed, nobody has deemed it "default", but is there any other such package that you can think of for this purpose.
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
Regards,
________________________________
From: Uwe Ligges<ligges at statistik.tu-dortmund.de>
To: Indrajit Sengupta<indra_calisto at yahoo.com>
Cc: "r-help at r-project.org"<r-help at r-project.org>; rch4<rch4 at geneseo.edu>
Sent: Tuesday, November 29, 2011 7:33 PM
Subject: Re: [R] Negative exponential fit
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.
Am 29.11.2011 07:06, schrieb Indrajit Sengupta:
What have you tried so far - can you explain? "fitdistrplus" package is the default package for fitting distributions. 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]]
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111130/d9d4c2f6/attachment.pl>
On Nov 29, 2011, at 23:19 , Ben Bolker wrote:
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. Rob
I disagree with the other solutions posted here: think you're looking not for a distribution, but for the change over time.
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)?
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.
______________________________________________ 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.
Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 11-11-30 11:32 AM, peter dalgaard wrote:
On Nov 29, 2011, at 23:19 , Ben Bolker wrote:
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. Rob
I disagree with the other solutions posted here: think you're looking not for a distribution, but for the change over time.
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)?
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=...)
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.
______________________________________________ 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.