[Rd] Use of lm on polynomial models (PR#14014)

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 19 12:02:02 CEST 2009


Others beware: this address does not accept replies, in defiance of 
the posting guide.

On Mon, 19 Oct 2009, Prof Brian Ripley wrote:

> 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:
>
>> 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.
>
> So it is behaving correctly.
>
>
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list