Skip to content
Prev 58436 / 398502 Next

Newbie question: plotting regression models

adelmaas at MUSC.EDU wrote:

            
Hi Aaron,

What type of "regression function" are your referring to? Linear model? 
Non-linear model? The term "regression" is to ambiguous to really answer 
your question. However, typically you should be able to do something like:

fit <- lm(y ~ x)
yhat <- predict(fit)
plot(x, y, ylim = range(c(y, yhat)))
lines(x, yhat)

If you are not using lm please provide more information than you already 
have. You should read "Introduction to R" or any of the recommended 
texts listed on the R website. Also read the posting guide.

--sundar