Fitting Data points . Is this correct ? Help Please !
Fitting periodic data.
When we have periodic data we might need to improve the basic least square model and turn it into a model that reflects the cycles that the data is representing. One efficient way to model l this cycling behavior is by adding cosines and sines to the function coefficients, adding as many possible new coefficients to the original function, interchanging the cosines and sines in every coefficient in the system.
With this trick we are constructing a minimal polynomial associated with the matrix of the system with a larger degree, which will give a fitting curve instead of a simple linear regression. On the other hand, it would be expected that the condition number of the original matrix becomes very large because the polynomial creates a Vandermonde matrix which is traditionally an illÂconditioned matrix and increments this condition as the grade of the polynomial approaches (nÂ1) .
To solve this issue we just need to avoid computing the product of this matrix with its transpose and solve the system with the Graham Smith method. In this case we will gain the advantages given by fitting a curve, but simultaneously avoid making the infinity norm of the system very large.
If we measure the residual error it will show that the fitting curve is accurate and the computation process is low cost.
For example, outside air temperatures obey cycles on numerous time scales, including daily and yearly cycles depending on the rotation of the earth and the revolution of the earth around the sun.
If we choose the standard linear regression model to describe data with these characteristics, the resulting line residual would be very large and predictions made with this model would be highly inaccurate.
Instead we can use F(t ) = c1 + c2 cos2pi(t) + c3 sin2pi ( t ) and build an undetermined system with dates of the temperatures at a equally divided times the day or year. Even better, we can improve it by adding coefficients to the matrix (like stated before) in this way:
F(t) = c1+ c2cos2pi(t) + c3sin2pi(t) + c4 cos4pi(t) + .........+ cnÂ1 cos/sin (nÂ1) 2(nÂ1)pi(tnÂ1)