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 fit a polynom of > 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,... instead of orthogonal > polynomials (which are "better" numerically but may be not what you need). > > Regards, > Moshe. > > --- On Fri, 8/1/10, chrisli1223 <chri...@austwaterenv.com.au> wrote: > >> From: chrisli1223 <chri...@austwaterenv.com.au> >> Subject: [R] Polynomial equation >> To: r-help@r-project.org >> Received: Friday, 8 January, 2010, 12:32 PM >> >> Hi all, >> >> I have got a dataset. In Excel, I can fit a polynomial >> trend line >> beautifully. However, the equation that Excel calculates >> appear to be >> incorrect. So I am thinking about using R. >> >> My questions are: >> (1) How do I fit a polynomial trendline to a graph? >> (2) How do I calculate and display the equation for that >> trendline? >> >> Many thanks for your help. Greatly appreciated. >> >> Chris >> -- >> View this message in context: >> http://n4.nabble.com/Polynomial-equation-tp1009398p1009398.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help@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. >> > > ______________________________________________ > R-help@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. > > -- View this message in context: http://n4.nabble.com/Polynomial-equation-tp1009398p1009438.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.