If we're finding an interpolating polynomial for 10 data pairs, the order of the polynomial has to be 9.
In class, my professor said that when doing a polynomial least squares fit, if you have 10 data pairs, then the polynomial with the maximum order will have an order of 9.
However, I've seen in some numerical methods book that they use that the maximum is 8 (which I think is wrong).
Wolfram's page includes no restriction whatsoever.
And as a homework I have been given the task to create a program for polynomial least squares fitting, where the user specifies the maximum order polynomial that is to be calculated.
I don't know if I should include a certain restriction here.
It seems arbitrary to include a restriction. What do you guys think? What is more mathematically sound/accepted/correct ?
Here's my guess.
Well suppose you have N data points. If you fit a polynomial of order M, then you essentially have N equations with M unknowns. If $M>N$ then you have more unknowns than equations. This is definitely not advisable (the regression requirements are not satisfied). If $M=N$, you have M equations and N unknowns and would get a perfect fit. (This might cause the least squares regression to give an error in some cases). That leaves $M<N$
Edit: I forgot about the constant. A polynomial of order $M$ would imply $M+1$ unknowns and this $M\leq (N-2)$. That might be where the $8$ comes from. Therefore, my explanation of the difference comes from the fact that one might to avoid the case where the polynomial "perfectly" matches the data.