Next: Fitting Examples, Previous: Large Dense Linear Systems, Up: Least-Squares Fitting [Index]
When using models based on polynomials, care should be taken when constructing the design matrix X. If the x values are large, then the matrix X could be ill-conditioned since its columns are powers of x, leading to unstable least-squares solutions. In this case it can often help to center and scale the x values using the mean and standard deviation:
x' = (x - mu)/sigma
and then construct the X matrix using the transformed values x'.