cgw at witthoft.com
2009-Jan-12 16:54 UTC
[R] lm: how are polynomial functions interpreted?
[This email is either empty or too large to be displayed at this time]
On Mon, 12 Jan 2009, cgw at witthoft.com wrote: [nothing deleted] matplot(1:100, lm(rnorm(100)~poly(1:100,4),x=T)$x ) # for example> > ______________________________________________ > 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.htmlAhem!> and provide commented, minimal, self-contained, reproducible code.......^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
damn. My apologies to everyone -- I sent one message and it got destroyed somehow. Here's the part that was missing, which led to rather a lot of confusion on all parts. The two recent responses to a question about lm suggested 1) lm(y~poly(x,2)) 2) lm(y~I(x^2)) So my question was *supposed* to be related to how lm operated differently (if at all) on these two different 'versions' of a quadratic fit. My gut reaction was that y~I(x^2) would not be the same as y~f(x) where f(x) is a+bx+cx^2 . So what I was trying to find out was just how lm() deals with various definitions of the orthogonal polynomials its presented with. Another way, maybe, to ask, is: how does one specify to fit exactly to a + bx +cx^2 vs bx + cx^2 vs cx^2 ? Thanks and apologies again to all the people who quite properly misunderstood what I was harping on due to the munging of my first post. Carl David Winsemius wrote:> > On Jan 12, 2009, at 5:57 PM, Carl Witthoft wrote: > >> Well..... *_* , >> >> I think it should have been clear that this was not a question for >> which any code exists. In fact, I gave two very specific examples of >> function calls. > > Huh? I think most of the readers of the list saw a basically empty > message body. That was the point of Berry's "[nothing deleted]". If you > are under the belief that this is a continuation of an earlier question, > then it may not be threading up in the manner you hoped for. >
A http://polynomial-trimonial-binomial.blogspot.com/2011/10/how-to-deal-with-polynomials.html polynomial function is evaluated by foiling out the equation so you can solve for 'x'. -- View this message in context: http://r.789695.n4.nabble.com/lm-how-are-polynomial-functions-interpreted-tp875663p4033696.html Sent from the R help mailing list archive at Nabble.com.