[R] Regression on non linear model
Bill Venables
William.Venables at cmis.CSIRO.AU
Thu Oct 14 08:58:00 CEST 1999
> >
> > 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 at cmis.csiro.au
Fax: +61 7 3826 7304
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list