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

2012-07-10 Thread William Dunlap
egree, raw = raw)) 1: poly(m, degree = 6, raw = TRUE) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of YTP > Sent: Tuesday, July 10, 2012 11:23 AM > To: r-help@r

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

2012-07-10 Thread YTP
Yep, that code is verbatim what I typed in, using version 2.14 ... seems weird. -- View this message in context: http://r.789695.n4.nabble.com/Specify-model-with-polynomial-interaction-terms-up-to-degree-n-tp4635130p4636031.html Sent from the R help mailing list archive at Nabble.com. _

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

2012-07-08 Thread Rui Barradas
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 <

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

2012-07-07 Thread Peter Ehlers
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

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

2012-07-07 Thread YTP
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]],

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

2012-07-03 Thread Rui Barradas
Hello, Sorry, but it was you that misread some of the suggestions. I have written raw=TRUE not raw=raw. Just see m <- matrix(1:6, ncol=2) # your example p2 <- poly(m, degree=2, raw=TRUE) # it's raw=TRUE, not raw=raw !!! deg2 <- attr(p2, 'degree') == 2 p2[, deg2] p6 <- poly(m, degree=6, raw

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

2012-07-02 Thread YTP
I think you have taken my toy example seriously. Perhaps I wasn't clear, but I am in fact not working with a dataset of 3 observations of the numbers 1 through 6 and trying to estimate anything; that was an example to illustrate what I am asking for, namely, turning two variables like this X1 X2

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

2012-07-02 Thread David Winsemius
On Jul 2, 2012, at 4:13 PM, YTP wrote: I am not sure that method works. It appears to be doing something close, but returns too many slope coefficients, since I think it is returning interaction terms of degree smaller and greater than what was passed to it. No. It _was_ doing what you as

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

2012-07-02 Thread YTP
I am not sure that method works. It appears to be doing something close, but returns too many slope coefficients, since I think it is returning interaction terms of degree smaller and greater than what was passed to it. Here is a small example of degree 2: > X = data.frame(cbind(c(1,2,3), c(4,5,

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

2012-07-02 Thread YTP
Hi Bert, thank you for pointing out that this method does not work. Do you happen to have any ideas as to how it could be done? Many thanks. -- View this message in context: http://r.789695.n4.nabble.com/Specify-model-with-polynomial-interaction-terms-up-to-degree-n-tp4635130p4635197.html Sent fr

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

2012-07-02 Thread Rui Barradas
Hello, Another way is to cbind the vectors 'a' and 'b', but this needs argument 'raw' set to TRUE. poly(cbind(a, b), 6, raw=TRUE) To the OP: is this time series related? With 6 being a lag or test (e.g., Tsay, 1986) order? I'm asking this because package nlts has a function for this test up

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

2012-07-02 Thread Bert Gunter
Inline below. -- Bert On Mon, Jul 2, 2012 at 8:04 AM, David Winsemius wrote: > > On Jul 2, 2012, at 10:51 AM, David Winsemius wrote: > > >> On Jul 2, 2012, at 9:29 AM, YTP wrote: >> >> I would like to specify a model with all polynomial interaction terms >>> between >>> two variables, say, up t

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

2012-07-02 Thread David Winsemius
On Jul 2, 2012, at 10:51 AM, David Winsemius wrote: On Jul 2, 2012, at 9:29 AM, YTP wrote: I would like to specify a model with all polynomial interaction terms between two variables, say, up to degree 6. For example, terms like a^6 + (a^5 * b^1) + (a^4 * b^2) + ... and so on. The doc

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

2012-07-02 Thread David Winsemius
On Jul 2, 2012, at 9:29 AM, YTP wrote: I would like to specify a model with all polynomial interaction terms between two variables, say, up to degree 6. For example, terms like a^6 + (a^5 * b^1) + (a^4 * b^2) + ... and so on. The documentation states The ^ operator indicates crossing to

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

2012-07-02 Thread YTP
I would like to specify a model with all polynomial interaction terms between two variables, say, up to degree 6. For example, terms like a^6 + (a^5 * b^1) + (a^4 * b^2) + ... and so on. The documentation states The ^ operator indicates crossing to the specified degree. so I would expect a mod