Message: 1
Date: Mon, 2 Nov 2009 15:42:53 -0800
From: Emily Benson <erbenson1 at gmail.com>
Subject: [R-sig-eco] Plot a polynomial regression
To: r-sig-ecology at r-project.org
Message-ID:
<91cdc84e0911021542o421a6e80h7613423a198efb2c at mail.gmail.com>
Content-Type: text/plain
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]]
------------------------------