I am trying to generate orthogonal polynomials in R, but I keep getting an error I don't understand
> poly(1:1000, 50)
Error in poly(1:1000, 50) :
'degree' must be less than number of unique points
Surely the number of unique points is 1000? What does it mean? Is this a bug, and if so does anyone know I work around?
Edit: This appears to kick in for degree > 27 for any number of points - is this an undocumented limit?
Numerical overflow. If you look at the code for poly
, you'll see it's generating the individual polynomial terms as an intermediate step:
X <- outer(x, seq_len(n) - 1, "^")
and when n
(the degree of the polynomial you want) is 50, the resulting terms go up to 1e132.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With