Skip to content

Use of lm on polynomial models (PR#14014)

3 messages · michael_karsh at earthlink.net, Brian Ripley

#
Full_Name: Michael Aaron Karsh
Version: 2.8.0.
OS: Windows XP
Submission from: (NULL) (75.61.102.255)


When I try lm(w ~ h^3 + h^2 + h) for example, it only gives coefficients for the
intercept and for h.  It does not give coefficients for h^2 or h^3.
#
RTFM time: h^3 is not the cube of h in an R formula (for that you need 
I(h^3)).  See ?formula, for example.

Simpler would be lm(w ~ poly(h, 3, raw=TRUE))
On Sun, 18 Oct 2009, michael_karsh at earthlink.net wrote:

            
So it is behaving correctly.
#
Others beware: this address does not accept replies, in defiance of 
the posting guide.
On Mon, 19 Oct 2009, Prof Brian Ripley wrote: