From ripley at stats.ox.ac.uk  Mon Oct 19 11:40:44 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 19 Oct 2009 10:40:44 +0100 (BST)
Subject: [Rd] Use of lm on polynomial models (PR#14014)
In-Reply-To: <20091018183016.B7EDB282EF53@mail.pubhealth.ku.dk>
References: <20091018183016.B7EDB282EF53@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.0910191035490.13539@gannet.stats.ox.ac.uk>

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



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