[R] Specify model with polynomial interaction terms up to degree n

Peter Ehlers ehlers at ucalgary.ca
Sun Jul 8 04:00:29 CEST 2012

On 2012-07-07 14:56, YTP wrote:
> Hi Rui,
> Thanks for responding. I did not write "raw=raw", and I'm not sure why R
> would return such a misleading error message. Indeed, the same error message
> comes up when I run the 2nd part of your code:
>> m <- matrix(1:6, ncol=2)
>> p6 <- poly(m, degree=6, raw=TRUE)
> Error in poly(dots[[1L]], degree, raw = raw) :
>    'degree' must be less than number of unique points

Are you sure that you submitted the poly() exactly as
you show above? I can get your error with raw=FALSE or
NULL or NA or 0 but not with raw=TRUE (or any nonzero

This is with R version 2.15.1 Patched (2012-06-27 r59661).

Peter Ehlers

> However I can think of a workaround for this, and I get the main idea from
> your example, which does exactly what I was hoping for, thanks very much!
> --
> View this message in context: http://r.789695.n4.nabble.com/Specify-model-with-polynomial-interaction-terms-up-to-degree-n-tp4635130p4635732.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list