3 Nov 00:42
Plot a polynomial regression
Hi,
For these data, my independent variable is river discharge (Discharge) and
my dependent variable is an estimate of gross primary production (GPP). I
have fitted a polynomial regression to my data using the following command:
> model<-lm(GPP ~ poly(Discharge, 2), data=nighttimeds1.dat)
I can produce a scatterplot of the data using the following commands:
> # Make a plot with Discharge on the x-axis and GPP on the y-axis;
> library(lattice)
> xyplot((GPP)~(Discharge), groups=Site, data=nighttimeds1.dat,
+ col=c("red","blue","green","yellow"), type="p")
What I would like to do is include the polynomial regression curve on the
scatterplot of the data, but I cannot figure out how to do this.
Can anyone help me?
Thank you,
Emily
[[alternative HTML version deleted]]
RSS Feed