# Re: [R] Regression on non linear model

Subject: Re: [R] Regression on non linear model
From: Bill Venables (William.Venables@cmis.CSIRO.AU)
Date: Thu 14 Oct 1999 - 16:58:00 EST

```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.
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
```

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:09 EST