[R-sig-ME] poly() and rcs()?

Paul Johnson pauljohn32 at gmail.com
Wed Nov 18 05:19:51 CET 2009


On Sun, Nov 15, 2009 at 2:20 PM, Antoine Tremblay <trea26 at gmail.com> wrote:
> Dear all,
>
> Here is a question regarding the difference between using poly() and rcs().
>
> If you fit a model using poly(), as shown below, the summary returns
> statistics for the term "linear" term,
> poly(TrialContinuous,2,raw=TRUE)1, and statistics for the quadratic,
> poly(TrialContinuous,2,raw=TRUE)2.
[snip]
> Now, if you use rcs() instead, the summary return statistics for the
> first and second splines, as shown below. We see that the 2 splines
> are significant, but there is no interaction between any of the
> splines and FreqGroup.

Dear Antoine:

I am not an expert, but I *think* you need to more carefully consider
what rcs does. If you are using rcs from the  Design package, that is:
  It is a restricted cubic spline.  It is not similar to poly looking
for a parametric curve across the whole range. Rather, it is dividing
up the range of X into pieces and then fitting a cubic curve to each
one. There is not supposed to be a "linear" term.

A couple of years ago, I decided to try to master some of that
terminology and I wrote up something for my class.  I'm pretty sure I
got the rcs part correct.

http://pj.freefaculty.org/stat/Splines/nonparametricModels.pdf

Look down to p. 17, where (I see now) I was curious about where the
linear term went, just like you are now.

Good luck

pj

> --
> Antoine Tremblay
> Department of Neuroscience
> Georgetown University
> Washington DC
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas




More information about the R-sig-mixed-models mailing list