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

William Dunlap wdunlap at tibco.com
Tue Jul 10 22:01:51 CEST 2012


a) Please supply some context in your mail message.  Not everyone reads R-help via nabble.

b) poly(raw=TRUE, x, degree=degree) was changed for 2.15.0 to allow it to output
a non-full-rank matrix.  See the NEWS file in 2.15.0 or after:
  > # in R-2.15.1
  > n <- news()
  > n[grepl("poly", n$Text),]
  Changes in version 2.15.0:  
  
  NEW FEATURES
  
      o   poly(raw = TRUE) no longer requires more unique points than the
          degree.  (Requested by John Fox.)
  ...

c) Error messages include the innermost R function call before the error.  To see more call traceback(),
which will show the call stack from the innermost call back to the call you made:

  > # in R-2.14.1
  > m <- matrix(1:6, ncol=2)
  > poly(m, degree=6, raw=TRUE)
  Error in poly(dots[[1L]], degree, raw = raw) :
    'degree' must be less than number of unique points
  > traceback()
  6: stop("'degree' must be less than number of unique points")
  5: poly(dots[[1L]], degree, raw = raw)
  4: cbind(1, poly(dots[[1L]], degree, raw = raw))
  3: polym(V1 = 1:3, V2 = 4:6, degree = 6, raw = TRUE)
  2: do.call("polym", c(m, degree = degree, raw = raw))
  1: poly(m, degree = 6, raw = TRUE)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of YTP
> Sent: Tuesday, July 10, 2012 11:23 AM
> To: r-help at r-project.org
> Subject: Re: [R] Specify model with polynomial interaction terms up to degree n
> 
> 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.
> 
> ______________________________________________
> 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