From William.Venables@cmis.CSIRO.AU  Thu Oct 14 07:58:00 1999
From: William.Venables@cmis.CSIRO.AU (Bill Venables)
Date: Thu, 14 Oct 1999 16:58:00 +1000
Subject: [R] Regression on non linear model
In-Reply-To: Your message of "Thu, 14 Oct 1999 07:38:39 +0100."
 <Pine.GSO.4.05.9910140730380.9722-100000@auk.stats>
Message-ID: <199910140700.RAA23011@snowy.nsw.cmis.CSIRO.AU>

> > 
> > The preferred way to do this is to use the I() function to protect
> > the ^2 and ^3 from being evaluated as part of the linear model
> > formula.  That is, write the call to lm with
> > 
> >  formula = Response ~ Var1 + I(Var1^2) + I(Var1^3)
> 
> I was doing this in a practical class yesterday. There is another way,
> 
> Response ~ poly(Var1, 3)
> 
> which fits the same cubic model by using orthogonal polynomials, and
> that has a number of numerical and statistical advantages. The fitted
> values will be the same, but the coefficients are those of the orthogonal
> polynomials, not the terms in the polynomial.  As I was telling my
> students, you might like to compare the two approaches.

One further advantage of doing it this way (in S-PLUS at least) is that you can
plot that component of the fitted curve very simply using plot.gam.  Now I know
we don't have a gam() in R yet, but I hope we plan to do so sometime and my
suggestion would be to start with a plot.gam and release that first.  It could
be done in a wet weekend (but I regret to say the weekends here are simply
beautiful.... :-)

-- 
-----------------------------------------------------------------
Bill Venables, Statistician, CMIS Environmetrics Project.

Physical address:                            Postal address:
CSIRO Marine Laboratories,                   PO Box 120,       
233 Middle St, Cleveland, Queensland         Cleveland, Qld, 4163
AUSTRALIA                                    AUSTRALIA

Telephone: +61 7 3826 7251     Email: Bill.Venables@cmis.csiro.au     
      Fax: +61 7 3826 7304


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[R] Regression on non linear model
Bill Venables