On Feb 13, 2010, at 1:35 PM, Rhonda Reidy wrote:
The following variables have the following significant relationships
(x is the explanatory variable): linear, cubic, exponential,
logistic. The linear relationship plots without any trouble.
Cubic is the 'best' model, but it is not plotting as a smooth curve
using the following code:
cubic.lm<- lm(y~poly(x,3))
Try:
lines(0:80, predict(cubic.lm, data.frame(x=0:80)),lwd=2)
But I really must say the superiority of that relationship over a
linear one is far from convincing to my eyes. Seems to be caused by
one data point. I hope the quotes around "best" mean tha tyou have the
same qualms.
lines(x,predict(cubic.lm),lwd=2)
How do I plot the data and the estimated curves for all of these
regression models in the same plot?
x <- c(62.5,68.5,0,52,0,52,0,52,23.5,86,0,0,0,0,0,0,0,0,0,0)
y <-
c
(0.054,0.055,0.017,0.021,0.020,0.028,0.032,0.073,0.076,0.087,0.042,0.042,0.041,0.045,0.021,0.018,0.017,0.018,0.028,0.022
)
Thanks in advance.
Rhonda Reidy
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
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.