From: chrisli1223 <chrisli at austwaterenv.com.au>
Subject: Re: [R] Polynomial equation
To: r-help at r-project.org
Received: Friday, 8 January, 2010, 2:14 PM
Thank you very much for your help. Greatly appreciated!
However, due to my limited stats background, I am unable to
find out the
equation of the trendline from the summary table. Besides,
how do I fit the
trendline on the graph?
I intend to put the first column of data onto x axis and
the second column
onto y axis. Are they the x and y in your example?
Many thanks,
Chris
Moshe Olshansky-2 wrote:
Hi Chris,
You can use lm with poly (look ?lm, ?poly).
If x and y are your arrays of points and you wish to
degree 4, say, enter:? model <-
lm(y~poly(x,4,raw=TRUE) and then
summary(model)
The raw=TRUE causes poly to use 1,x,x^2,x^3,...
polynomials (which are "better" numerically but may be
Regards,
Moshe.
--- On Fri, 8/1/10, chrisli1223 <chrisli at austwaterenv.com.au>
From: chrisli1223 <chrisli at austwaterenv.com.au>
Subject: [R]? Polynomial equation
To: r-help at r-project.org
Received: Friday, 8 January, 2010, 12:32 PM
Hi all,
I have got a dataset. In Excel, I can fit a
trend line
beautifully. However, the equation that Excel
appear to be
incorrect. So I am thinking about using R.
My questions are:
(1) How do I fit a polynomial trendline to a
(2) How do I calculate and display the equation