Try this to see the X matrix that its fitting y to: x <- 1:10 model.matrix(~ poly(x, 2)) model.matrix(~ I(x^2))
On Mon, Jan 12, 2009 at 9:01 PM, Carl Witthoft <c...@witthoft.com> wrote: > 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. >> > > ______________________________________________ > 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.