[R] using abline and a fitted 2nd degree formula

CG Pettersson cg.pettersson at evp.slu.se
Wed Nov 9 10:56:14 CET 2005


Hello all,

R2.1.1, Wk2

I am doing some two-step plotting, first using plot() to illustrate the
datapoints and then using abline() to place a trend line from a fitted
model into the plot.

Everything works well as long as the formula of the fitted model i of the
type:

m1 <- lm(Dependent ~ Independent)
then abline(m1) puts the proper straight line into the plot.

But if I use:

m2 <- lm(Dependent ~ Independent + I(Independent^2))
abline(m2) produces a straight line, only from the first order term.

Why, and what should I do about it?

Cheers
/CG




-- 
CG Pettersson, MSci, PhD Stud.
Swedish University of Agricultural Sciences (SLU)
Dep. of Crop Production Ekology. Box 7043.
SE-750 07 Uppsala, Sweden
cg.pettersson at evp.slu.se




More information about the R-help mailing list