Answer to HW 3 Qn 1:

i) Equations:

a) y = 8.0714

b) y = -0.0004x + 8.8689

c) y = 0.00000013 x^2 - 0.000938x + 9.1720

d) y = 0.00000001 x^2 - 0.000750x + 9.1223

e) y = 0.0003 X^7 -0.0079 x^6 + 0.1129 x^5 -0.8510 x^4 + 2.9623 x^3 -3.3327 x^2 -0.8897 x + 9.9191

ii) Graphs:

Following figure contains the plot of the original data points as well as the plots for equations a to d :

Plots of regression functions

Following figure contains the plot of the 10 selected data points and the 9 degree curve fitting these points:

Plot of 9th degree polynomial

iii) Residual Errors:

a) E0 = [-2.8714 -2.5714 -2.2714 -1.8714 -1.3714 -1.2714 -1.1714 -1.0714 -0.9714 -0.9714 -0.9714 -0.8714 -0.5714 -0.3714 -0.3714 -0.2714 -0.0714 0.0286 0.1286 0.2286 0.6286 0.8286 1.0286 1.0286 1.1286 1.1286 1.2286 1.2286 1.4286 1.4286 1.5286 1.5286 1.7286 1.8286 1.8286 ]

|E0| = 7.8148 <\p>

b) E1 = [-2.6801 -2.6262 -1.8389 -2.4095 -1.5947 -0.4474 -0.5997 -0.6438 -1.2000 -0.6462 -0.4224 -0.4478 -0.5269 0.0469 -0.6377 0.7246 -0.7811 0.3041 -0.3802 0.3250 -0.1418 0.6009 0.8470 0.7401 0.9878 1.2516 1.0115 1.1822 1.5378 1.8841 1.1488 2.1965 1.1648 1.0320 1.0502]

|E1| = 7.3067

c) E2 = [ -2.5505 -2.4789 -1.8071 -2.4694 -1.4833 -0.7443 -0.6607 -0.6092 -1.0904 -0.5610 -0.4695 -0.4110 -0.3767 0.0866 -0.5417 0.2168 -0.9916 0.4097 -0.4185 0.4713 -0.4153 0.7108 0.9709 0.8272 1.1216 1.3945 1.1249 1.3303 1.6826 1.9024 1.1920 2.0558 1.0849 0.7298 0.7680]

|E2| = 7.2419

d) E3 = [-2.5342 -2.4919 -1.7748 -2.4905 -1.5121 -0.7674 -0.6331 -0.5770 -1.1195 -0.5330 -0.4395 -0.3788 -0.3778 0.1188 -0.5729 0.1176 -0.9742 0.4330 -0.4433 0.4765 -0.3766 0.6817 0.9452 0.7951 1.0995 1.4029 1.0966 1.3182 1.6894 1.9348 1.1589 2.0714 1.0677 0.7791 0.8099 ]

|E3| = 7.2395

e) E9 = 1.0e-009 * [ -0.1863 0.0002 -0.9313 0.7451 0 0 -0.0116 0 -0.0001 0]

|E| = 1.2072e-009

iv) Table comparing coefficients of every equation

Equation Type Constant term Coeff of x Coeff of x^2 Coeff of x^3 Coeff of X^4 Coeff of X^5 Coeff of X^6 Coeff of X^7 Coeff of X^8 Coeff of X^9
a) Zero order 8.01 0 0 0 0 0 0 0 0 0
b) Linear 8.8689 -0.0004 0 0 0 0 0 0 0 0
c) Quadratic 9.1720 - 0.000938 0.00000013 0 0 0 0 0 0 0
d) Cubic 9.1223 0.000750 0.00000001 0 0 0 0 0 0 0
e) 9th degree 9.9191 -0.8897 -3.3327 2.9623 -0.8510 0.1129 -0.0079 0.0003 0 0

v) Results of f:

Linear equation : cpi = -0.0005*rank - 0.0578*age + 10.0467

Error Matrix: E = [2.6870 2.5215 1.8996 2.4281 1.6082 0.4440 0.6581 0.5891 1.1559 0.6509 0.4346 0.4509 0.5361 -0.0437 0.5942 -0.7308 0.8025 -0.2986 0.3984 -0.2589 0.1064 -0.5295 -0.7764 -0.7833 -1.0333 -1.1859 -1.0559 -1.2293 -1.5297 -1.8816 -1.1905 -2.2551 -1.1458 -0.9515 -1.0855]

|E11| = 7.3021

Quadratic equation :cpi = 0.0012*rank^2 - 0.1127*age^2 + 0.0297*rank*age - 0.6877*rank + 4.0165*age - 25.9279

Error Matrix: [ -2.6476 -2.1676 -1.4222 -2.6255 -1.6230 -0.7302 -0.1581 -0.8889 -1.0084 -0.6393 -0.5126 -0.4737 -0.4917 0.0230 -0.4371 0.2707 -1.1508 0.3231 -0.5736 0.5833 0.0105 0.5746 0.8691 0.9452 1.1517 1.5275 1.2001 1.3058 1.5752 1.84491.3659 1.6587 0.9281 0.1933 1.1993

|E22] = 7.1237

vi) After observing the error obtained after fitting each function into the data distribution I would use the quadratic function for two variables as the best fitting function because it gives the minimum error.