[Rd] Contr.poly for n > 100 (PR#2326)

clifford@galton.uchicago.edu clifford@galton.uchicago.edu
Mon, 25 Nov 2002 22:23:40 +0100 (MET)


Full_Name: David Clifford
Version: Version 1.5.1  (2002-06-17)
OS: Red Hat 7.3
Submission from: (NULL) (128.135.149.55)


For n values above 100 there appears to be a bug in contr.poly(n).  

The contrast matrix should have rank n-1.

Running the code below gives output (ie errors) at n=98, 100 
and every value greater than 102.  

for(n in 2:150)
  {
    K <- contr.poly(n)
    rnk <- qr(K)$rank
    if(rnk != n-1) {
      cat(c(n,rnk))
      cat("\n")
    }
  }

Also the contr.poly code just breaks down at n=163 with the error:

Error in qr(X) : NA/NaN/Inf in foreign function call (arg 1)