[R] add non-linear line

From: Matt Sakals <msakals_at_interchange.ubc.ca>
Date: Wed 17 Jan 2007 - 15:42:45 GMT


I am trying to plot a non-linear trend line along with my data. I am sure the solution is simple; any help greatly appreciated.

Recent and historic attempts:
fit = nls((sd~a+b*exp(-c/time)+d*geology), start=list(a=1, b=1, c=10, d=-1), model=TRUE)
plot(time, sd, col=3, main = "Regression", sub=formula(fit)) lines(time, fitted.values(fit), lwd=2)

#tt = seq(from=0, to=200, by=10)
#lines(time, predict(fit, time=tt))
#lines(time, predict(fit))



R-help@stat.math.ethz.ch 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. Received on Thu Jan 18 03:07:01 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 Jan 2007 - 17:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.