[R] Polynomial regression problem

From: Matthew McKinney <mm.entomology_at_gmail.com>
Date: Tue, 15 Mar 2011 10:41:12 -0400

I have just started using R so forgive me if this question is very simple. I have a data set (in a data frame called dm) that looks like this

x (Cells) y(males)

1	0
2	2
3	7
4	12
5	12
6	19
7	22
8	23
9	25
10	23
11	23
12	11
13	8
14	3
15	0
16	0

I centered the dependent and predictor variables and then squared the predictor to make a quadratic variable.
This left me with 3 variables:

I then used: >quadraticModel <- lm(MalesC ~ CellsC + CellsC2, data = dm)

This has given me R^2= 0.8821, F= 48.63, and p<0.001

I ran the exact same data in sigma plot and got identical results. My problem comes from the estimated coefficients I am getting in R when using >summary(quadraticModel). My coefficient estimates in sigma plot fit my data set well and agree with Microsoft excels estimates. The results from R appear to be the coefficients of a curve fitting the residuals. If I >plot(quadraticModel) it does not draw a curve fitting my data, but rather the residuals.

What I would like to know is how I can get the coefficient estimates for the data rather than the residuals, and how to plot that in R.

Matthew McKinney

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 15 Mar 2011 - 15:51:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Mar 2011 - 19:20:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive