In: Statistics and Probability
Find the function of the form
f(t) = c0 + c1sin(t) + c2cos(t) + c3sin(2t) + c4cos(2t)
that best fits the data points (0,0), (0.5,0.5), (1,1), (1.5,1.5), (2,2), (2.5,2.5), (3,3), using least squares. Sketch the solution, together with the function g(t) = t.
t | sin t | cos t | sin (2t) | cos(2t) | y |
0 | 0 | 1 | 0 | 1 | 0 |
0.5 | 0.479426 | 0.877583 | 0.841471 | 0.540302 | 0.5 |
1 | 0.841471 | 0.540302 | 0.909297 | -0.41615 | 1 |
1.5 | 0.997495 | 0.070737 | 0.14112 | -0.98999 | 1.5 |
2 | 0.909297 | -0.41615 | -0.7568 | -0.65364 | 2 |
2.5 | 0.598472 | -0.80114 | -0.95892 | 0.283662 | 2.5 |
3 | 0.14112 | -0.98999 | -0.27942 | 0.96017 | 3 |
using Excel
SUMMARY OUTPUT | |||||
Regression Statistics | |||||
Multiple R | 0.999896184 | ||||
R Square | 0.999792378 | ||||
Adjusted R Square | 0.999377134 | ||||
Standard Error | 0.026956942 | ||||
Observations | 7 | ||||
ANOVA | |||||
df | SS | MS | F | Significance F | |
Regression | 4 | 6.998546647 | 1.749636662 | 2407.723582 | 0.000415201 |
Residual | 2 | 0.001453353 | 0.000726677 | ||
Total | 6 | 7 | |||
Coefficients | Standard Error | t Stat | P-value | Lower 95% | |
Intercept | 1.5 | 0.075852952 | 19.77510382 | 0.00254742 | 1.173631089 |
sin t | 0.108974218 | 0.121544186 | 0.896581088 | 0.464559036 | -0.413988204 |
cos t | -1.536691216 | 0.022576322 | -68.06649975 | 0.000215771 | -1.63382929 |
sin (2t) | 0.302691969 | 0.024514511 | 12.34746117 | 0.006495271 | 0.197214543 |
cos(2t) | 0.043147694 | 0.057848625 | 0.745872425 | 0.533494831 | -0.205754848 |
y^= 1.5 + 0.108974 sin t -1.53669 cos t + 0.3026919 sin 2t + 0.043147 cos 2t
t | sin t | cos t | sin (2t) | cos(2t) | y | y^ |
0 | 0 | 1 | 0 | 1 | 0 | 0.006456 |
0.5 | 0.479426 | 0.877583 | 0.841471 | 0.540302 | 0.5 | 0.481691 |
1 | 0.841471 | 0.540302 | 0.909297 | -0.41615 | 1 | 1.018702 |
1.5 | 0.997495 | 0.070737 | 0.14112 | -0.98999 | 1.5 | 1.5 |
2 | 0.909297 | -0.41615 | -0.7568 | -0.65364 | 2 | 1.981298 |
2.5 | 0.598472 | -0.80114 | -0.95892 | 0.283662 | 2.5 | 2.518309 |
3 | 0.14112 | -0.98999 | -0.27942 | 0.96017 | 3 | 2.993544 |