[R] add non-linear line
Matt Sakals
msakals at interchange.ubc.ca
Wed Jan 17 16:42:45 CET 2007
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))
More information about the R-help
mailing list