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

Antoine Tremblay trea26 at gmail.com
Wed Nov 18 06:12:22 CET 2009

Dear Paul,
Thank you very much for the document, it is of great help :-)

I guess what I mean by the linear term is the b1xi in the equation yi
= ˆb0 + ˆb1 xi + ˆb2 (xi − τ1 )3 + ˆb3 (xi − τ2 )3  + + . . .

The summary output for lmer with rcs() only seems to give statistics
for the b(xi − τ)3 s, but not for the b1xi term.

Thanks again for that document, it's great!


On Tue, Nov 17, 2009 at 11:19 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:
> 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

Antoine Tremblay
Department of Neuroscience
Georgetown University
Washington DC

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