Hi to all This is the first time I am quoting a question and I hope, my question is not too basic... For the following data, I wish to draw a fitted curve. x <- c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248) y <- c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08) If I plot the data, it looks somehow that a logistic function would render good results. My questions are: How do I use nls and/or SSlogis (or other) to fit the curve? How can I see the summary statistics of the fit? How do I finally draw the line to my x,y (untransformed data) plot? Any help would be highly appreciated. Thank you and cheers Pascale -- ____________________________________..___________________ Dr. Pascale Weber Swiss Federal Research Institute WSL Zuercherstrasse 111 CH-8903 Birmensdorf Switzerland
A simple y vs log(x) fit seems to work pretty well here: fit <- lm(y ~ log(x)) summary(fit) plot(y ~ log(x)) abline(fit) On Fri, Dec 4, 2009 at 9:06 AM, Pascale Weber <pascale.weber@wsl.ch> wrote:> Hi to all > > This is the first time I am quoting a question and I hope, my question is > not too basic... > > For the following data, I wish to draw a fitted curve. > > x <- c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248) > > y <- > c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08) > > If I plot the data, it looks somehow that a logistic function would render > good results. > > My questions are: > > How do I use > nls and/or SSlogis (or other) > to fit the curve? > > How can I see the summary statistics of the fit? > > How do I finally draw the line to my x,y (untransformed data) plot? > > Any help would be highly appreciated. > > Thank you and cheers > > Pascale > > -- > ____________________________________..___________________ > > Dr. Pascale Weber > Swiss Federal Research Institute WSL > Zuercherstrasse 111 > CH-8903 Birmensdorf > Switzerland > > ______________________________________________ > 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]]
Pascale, If you do want an nls fit with the associated error structure assumptions, check ?SSlogis. fm <- nls(y ~ SSlogis(x, Asy, xmid, scal)) summary(fm) xx <- seq(123, 248, length = 101) yy <- predict(fm, list(x = xx)) plot(x, y) lines(xx, yy) -Peter Ehlers Gabor Grothendieck wrote:> A simple y vs log(x) fit seems to work pretty well here: > > fit <- lm(y ~ log(x)) > summary(fit) > > plot(y ~ log(x)) > abline(fit) > > On Fri, Dec 4, 2009 at 9:06 AM, Pascale Weber <pascale.weber at wsl.ch> wrote: > >> Hi to all >> >> This is the first time I am quoting a question and I hope, my question is >> not too basic... >> >> For the following data, I wish to draw a fitted curve. >> >> x <- c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248) >> >> y <- >> c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.97,26.23,42.83,46.53,14.79,49.18,48.08) >> >> If I plot the data, it looks somehow that a logistic function would render >> good results. >> >> My questions are: >> >> How do I use >> nls and/or SSlogis (or other) >> to fit the curve? >> >> How can I see the summary statistics of the fit? >> >> How do I finally draw the line to my x,y (untransformed data) plot? >> >> Any help would be highly appreciated. >> >> Thank you and cheers >> >> Pascale >> >> -- >> ____________________________________..___________________ >> >> Dr. Pascale Weber >> Swiss Federal Research Institute WSL >> Zuercherstrasse 111 >> CH-8903 Birmensdorf >> Switzerland >> >> ______________________________________________ >> 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. > >