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

Rui Barradas ruipbarradas at sapo.pt
Sun Jul 8 11:52:49 CEST 2012


Hello,


Em 08-07-2012 03:00, Peter Ehlers escreveu:
> 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
> number).
>
> This is with R version 2.15.1 Patched (2012-06-27 r59661).
>
> Peter Ehlers
>

It works with me too.
This has some days already, but I remember the error message and that I 
had tested it before posting the code above.


sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


Rui Barradas

>> 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.
>>
>
> ______________________________________________
> 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