[R] Polynomial regression problem

Matthew McKinney
Tue, 15 Mar 2011 14:41:12 -0000

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:
MalesC
CellsC
CellsC2

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.

Thanks,
Matthew McKinney