Approximation: Polynomial OLS approximation

 

We modify the result of gird method in the following way:

where red points are the results from grid method. The estimated curve may deviate

 

form the points on the grid in some areas because this is based on all the points.

 

As we increase the order of polynomial, the resulting curve tends to fit better.

 

 

OLS coefficient can be derived by

 

 

where  is (order+1) x 1. We set

 

x1=[ones x x^2 x^3 . . . x^order]

 

given vectors of x and y.

 

For x0,

 

 

Notice that we cannot increase the number of order more than 9 or so. It will blow up.