[R] general question about plotting multiple regression results
S.Pickett at exeter.ac.uk
Thu Apr 19 13:33:02 CEST 2007
I have been bumbling around with r for years now and still havent come up
with a solution for plotting reliable graphs of relationships from a
Here is an example illustrating my problem
1.I do a linear regression as follows
which gives some nice sig. results
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.73917 0.43742 -1.690 0.093069 .
n.day1 1.00460 0.05369 18.711 < 2e-16 ***
ffemale.yell 0.22419 0.06251 3.586 0.000449 ***
fmale.yell 0.25874 0.06925 3.736 0.000262 ***
fmale.chroma 0.23525 0.11633 2.022 0.044868 *
2. I want to plot the effect of "ffemale.yell", "fmale.yell" and
"fmale.chroma" on my response variable.
So, I either plot the raw values (which is fine when there is a very
strong relationship) but what if I want to plot the effects from the
In this case I would usually plot the fitted values values against the raw
values of x... Is this the right approach?
#make a dummy variable across the range of x
#get the coefficients and draw the line
This often does the trick but for some reason, especially when my model
has many terms in it or when one of the independent variables is only
significant when the other independent variables are in the equation, it
gives me strange lines.
Please can someone show me the light?
Thanks in advance,
Centre For Ecology and Conservation
University of Exeter in Cornwall
More information about the R-help