[R-sig-eco] Plot a polynomial regression

Giovanni Petris GPetris at uark.edu
Tue Nov 3 15:20:04 CET 2009


See

?predict

HTH,
Giovanni

> Date: Mon, 02 Nov 2009 15:42:53 -0800
> From: Emily Benson <erbenson1 at gmail.com>
> Sender: r-sig-ecology-bounces at r-project.org
> Precedence: list
> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
> DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
> 
> 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]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> 
> 

-- 

Giovanni Petris  <GPetris at uark.edu>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/



More information about the R-sig-ecology mailing list