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

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Mon, 25 Nov 2002 21:39:15 +0000 (GMT)


It's not possible to represent orthogonal polynomials accurately to this
degree in the computer arithmetic used.  So, perhaps it is a bug, but
the attempt to use them made no sense.

The bug will not be fixed, but the attempt will give an error.

The same thing happens in S, for the same reason.

On Mon, 25 Nov 2002 clifford@galton.uchicago.edu wrote:

> 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)
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595