I'm trying to find the best polynomial regression for a dataset where the polynomial's power is between 2 and 10. So the regression can have an x10 term at most in it. The dataset itself is simply a set of x and y pairs as follows:
1,15.3
2,66.0
3,272.5
4,814.8
As I understand, the normal way to do a polynomial regression is to simply apply the power transformation to the x vector (i.e. put every element in the vector to the power of 6), add this vector to the dataset, and then treat this transformed vector as another independent variable.
However if I try this approach with high enough powers (usually 6 and above), my regression library (statsample for Ruby) tells me "Regressors are linearly dependent", and throws an error. I know that technically the x vectors are dependent on each other since they were derived from each other, but it's certainly not a linear dependency (where one is the same as the other multiplied by a scalar). What's going on? And what does this mean?
As an example, here's an example of my code in Ruby (I'm told that this library is a lot like R however, for all you R users):
# Read the dataset (like an R data frame??) containing just x and y (see the example above)
ds = CSV.read(file_name)
# For each possible polynomial power between 2 and 10, add a new vector which consists
# of the x vector to that power, and then run a regression
(2..10).each do |i|
# Add a vector called x2, x3, x4 etc. and apply the power transformation
ds.add_vector("x#{i}", ds["x"].map{ |x| x**i }.to_scale)
#Run the regression
reg = lr(ds,'y')
end