Prof Brian D Ripley
2000-Aug-13 18:58 UTC
[R] Fitting a curve to to an oscillating scatter . .
On Sun, 13 Aug 2000, Phil Rhoades wrote:> I have just got going with R and think it is really nice however, as far as > I can see, it can't do what I got it for:Sure it can. It is a fully fledging computing language.> I have some output from a computer simulation of mutating genes represented > by a biological statistic - so the graph looks roughly like the top of: > > x = y^2 > > - with oscillations around the general curve. > > If I use scatter.smooth() I get a nice curve representing the oscillations > but what the curve I want to fit is the more basic curve ie the top arm of > the x = y^2. > > Any suggestions?plot(x, y) fit <- lm(y ~ I(x^0.5)) # or y ~ sqrt(x) lines(predict(fit), sort(x)) if indeed the response is y to stimulus x. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi all, I have just got going with R and think it is really nice however, as far as I can see, it can't do what I got it for: I have some output from a computer simulation of mutating genes represented by a biological statistic - so the graph looks roughly like the top of: x = y^2 - with oscillations around the general curve. If I use scatter.smooth() I get a nice curve representing the oscillations but what the curve I want to fit is the more basic curve ie the top arm of the x = y^2. Any suggestions? Thanks, Phil. - Philip Rhoades Pricom Pty Limited (ACN 003 252 275) GPO Box 3411 Sydney NSW 2001 Australia Mobile: +61:0411-185-652 Fax: +61:2:8923-5363 E-mail: philr at mail.austasia.net -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._