Download as ppsx, pdf, or txt
Download as ppsx, pdf, or txt
You are on page 1of 18

Nonlinear

Regression Model
Maria Zefanya Sampe

Reference : Wooldridge J.M., Introductory econometrics, South-Western


College Pub., 2003 (WOO), Statistics 101 – Brandon Foltz
Case :
Relationship between :
Job Tenure Total Cars
• how many total cars have been sold by each salesperson (Weeks) Sold
• how many weeks each salesperson has worked 168 272
428 300
296 311
392 365
80 167
56 149
352 366
444 310
168 192
200 229
4 88
52 118
20 62
228 319
72 193
 
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏  
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐
Job Tenure Total Cars Job Tenure Total Cars
Weeks^2
(Weeks) Sold (Weeks) Sold
168 272 168 28224 272
428 300 428 183184 300
296 311 296 87616 311
392 365 392 153664 365
80 167 80 6400 167
56 149 56 3136 149
352 366 352 123904 366
444 310 444 197136 310
168 192 168 28224 192
200 229 200 40000 229
4 88 4 16 88
52 118 52 2704 118
20 62 20 400 62
228 319 228 51984 319
72 193 72 5184 193
80 Job Tenure (Weeks) Residual Plot 60 Job Tenure (Weeks) Residual Plot
60
40
40
20
20

Residuals
0
Residuals

0 0 50 100 150 200 250 300 350 400 450 500


0 50 100 150 200 250 300 350 400 450 500 -20
-20
-40
-40 Yes, there are pattern here
-60
-60
-80
GOOD ! No pattern here
-80 Job Tenure (Weeks) Job Tenure (Weeks)

Job Tenure (Weeks) Residual Plot


80

60

40

20
Residuals

0
0 50 100 150 200 250 300 350 400 450 500
-20

-40

-60

-80

Job Tenure (Weeks)


 
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏  
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏 +𝒃𝟐 𝒙𝟏 𝟐

Job Tenure (Weeks) Line Fit Plot


400

350

300

250
Total Cars Sold

Total Cars Sold


Linear (Total Cars Sold)
200
Polynomial (Total Cars Sold)
150 Predicted Total Cars Sold

100

50

0
0 50 100 150 200 250 300 350 400 450 500

Job Tenure (Weeks)

 ^𝒚 =𝟏𝟏𝟒 . 𝟒𝟗𝟔𝟑𝟐𝟒𝟖+𝟎 . 𝟓𝟖𝟐𝟐𝟖𝟐𝟏𝟑𝟖 𝒙 𝟏 ^ 𝒚 =𝟔𝟑 . 𝟖𝟓𝟎𝟗𝟔𝟗𝟑𝟒+𝟏 . 𝟒𝟎𝟗𝟒𝟓𝟐𝟓𝟒𝟑 𝒙 𝟏  −  0.00185214 8 𝒙𝟏𝟐
Quadratic Regression Model
Before : Linear Regression Model
  Coefficients
Intercept 114.4963248
Job Tenure (Weeks) 0.582282138

𝒚 =𝟏𝟏𝟒 . 𝟒𝟗𝟔𝟑𝟐𝟒𝟖+𝟎 . 𝟓𝟖𝟐𝟐𝟖𝟐𝟏𝟑𝟖 𝒙 𝟏


 ^

After : Quadratic Regression Model


(Nonlinear)
  Coefficients
Intercept 63.85096934
Job Tenure (Weeks) 1.409452543
Weeks^2 -0.001852148

^ 𝒚 =𝟔𝟑 . 𝟖𝟓𝟎𝟗𝟔𝟗𝟑𝟒+𝟏 . 𝟒𝟎𝟗𝟒𝟓𝟐𝟓𝟒𝟑 𝒙 𝟏  −  0.001852148 𝒙 𝟏𝟐

   
>0 <0
How about maximum point?
Finding Maximum Point
Remember : Calculus =)

Find the max or min of a quadratic model using


derivative of the polynomial

So, we have

^ 𝒚 =𝟔𝟑 . 𝟖𝟓𝟎𝟗𝟔𝟗𝟑𝟒+𝟏 . 𝟒𝟎𝟗𝟒𝟓𝟐𝟓𝟒𝟑 𝒙 𝟏  −  0.001852148 𝒙 𝟏𝟐

 𝒅 𝟐
( 𝟔𝟑 . 𝟖𝟓𝟎𝟗𝟔𝟗𝟑𝟒+𝟏 . 𝟒𝟎𝟗𝟒𝟓𝟐𝟓𝟒𝟑 𝒙 𝟏  −  0.001852148 𝒙 𝟏   )
𝒅𝒙

𝟏  . 𝟒𝟎𝟗𝟓− 𝟎 . 𝟎𝟎𝟑𝟖 𝒙𝟏  =0

𝟎  . 𝟎𝟎𝟑𝟖𝟔 𝒙 𝟏  =𝟏 . 𝟒𝟎𝟗𝟓


 𝒙 𝟏  =𝟑𝟕𝟎. 𝟗𝟐 Yeay! We get maximum point =)
^ 𝒚 =𝟔𝟑 . 𝟖𝟓𝟎𝟗𝟔𝟗𝟑𝟒+𝟏 . 𝟒𝟎𝟗𝟒𝟓𝟐𝟓𝟒𝟑 𝒙 𝟏  −  0.001852148 𝒙 𝟏𝟐

  Maximum Point = 370.92 weeks

Conclusion?
Conclusion
• The maximum number of cars sold
from Salesperson at around 317 weeks
on the job.
• After that, the number of cars sold
begins to go down (for several reason :
they get too old, tired being at the job,
sales competition, etc.
How if we do
another polynomial
regression models ?
Quadratic Polynomial
Regression Statistics
 
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐
Multiple R 0.95263863
R Square 0.90752036 Job Tenure Total Cars
Weeks^2
Adjusted R Square
Standard Error
0.892107086
32.67505089
(Weeks) Sold
Observations 15 168 28224 272
428 183184 300
  Coefficients Standard Error t Stat P-value
Intercept 63.85096934 19.62804309 3.253048154 0.006917223 296 87616 311
Job Tenure (Weeks) 1.409452543 0.23064056 6.111035036 5.24735E-05 392 153664 365
Weeks^2 -0.001852148 0.000500369 -3.701561402 0.003027121
80 6400 167
56 3136 149
400 Job Tenure (Weeks) Line Fit Plot 352 123904 366
350 444 197136 310
300 168 28224 192
250
200 40000 229
Total Cars Sold

Total Cars Sold 4 16 88


200 Polynomial (Total Cars Sold)
Predicted Total Cars Sold
52 2704 118
150
20 400 62
100
228 51984 319
50 72 5184 193
0
0 50 100 150 200 250 300 350 400 450 500
Job Tenure (Weeks)
Cubic Polynomial
 
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐 +𝒃𝟑 𝒙 𝟏𝟑
Job Tenure Weeks^2 Weeks^3 Total Cars
Regression Statistics (Weeks) Sold
Multiple R 0.956708 168 28224 4741632 272
R Square 0.915291
428 183184 78402752 300
Adjusted R Square 0.892188
Standard Error 32.66279
296 87616 25934336 311
Observations 15 392 153664 60236288 365
80 6400 512000 167
56 3136 175616 149
  Coefficients Standard Error t Stat P-value
352 123904 43614208 366
Intercept 80.07145 25.41111 3.151041 0.009225 444 197136 87528384 310
Job Tenure (Weeks) 0.877161 0.577891 1.517865 0.157251 168 28224 4741632 192
Weeks^2 0.001309 0.003187 0.410825 0.68909
200 40000 8000000 229
Weeks^3 -4.8E-06 4.73E-06 -1.0045 0.336725
4 16 64 88
52 2704 140608 118
20 400 8000 62
P value > α 228 51984 11852352 319
72 5184 373248 193
Cubic Polynomial
Job Tenure (Weeks) Line Fit Plot
400

350

300

250
Total Cars Sold

Total Cars Sold


200 Predicted Total Cars Sold
Polynomial (Predicted Total Cars Sold)

150
𝒚 =𝒃 𝟎 +𝒃𝟏
 ^ 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐 +𝒃𝟑 𝒙 𝟏𝟑
100

50

0
0 50 100 150 200 250 300 350 400 450 500

Job Tenure (Weeks)


Quartic Polynomial
 
^𝒚 =𝒃 𝟎 +𝒃𝟏 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐 +𝒃𝟑 𝒙 𝟏𝟑 +𝒃 𝟒 𝒙𝟏𝟒
Regression Statistics Job Tenure Weeks^2 Weeks^3 Weeks^4
Multiple R 0.963394592
(Weeks) Total Cars Sold
R Square 0.92812914
168 28224 4741632 796594176 272
Adjusted R Square 0.899380795
428 183184 78402752 33556377856 300
Standard Error 31.55442364
296 87616 25934336 7676563456 311
392 153664 60236288 23612624896 365
Observations 15
80 6400 512000 40960000 167
56 3136 175616 9834496 149
Standard
352 123904 43614208 15352201216 366
  Coefficients Error t Stat P-value 444 197136 87528384 38862602496 310
Intercept 58.13030581 29.53207 1.968379 0.077352 168 28224 4741632 796594176 192
Job Tenure (Weeks) 1.999872371 1.008615 1.982792 0.075521 200 40000 8000000 1600000000 229
Weeks^2 -0.010609357 0.009434 -1.1246 0.287028 4 16 64 256 88
Weeks^3 3.76344E-05 3.2E-05 1.174589 0.267371
52 2704 140608 7311616 118
Weeks^4 -4.76313E-08 3.56E-08 -1.33654 0.210986
20 400 8000 160000 62
228 51984 11852352 2702336256 319
72 5184 373248 26873856 193
P value > α
Quartic Polynomial
Job Tenure (Weeks) Line Fit Plot
400

350

300

250
Total Cars Sold
Total Cars Sold

Predicted Total Cars Sold


200 Polynomial (Predicted Total Cars Sold)

150

𝒚 =𝒃 𝟎 +𝒃𝟏
 ^ 𝒙𝟏 +𝒃𝟐 𝒙𝟏𝟐 +𝒃𝟑 𝒙 𝟏𝟑 +𝒃 𝟒 𝒙𝟏𝟒
100

50

0
0 50 100 150 Job Tenure
200 (Weeks) 300
250 350 400 450 500
Quintic Polynomial
 

Job Tenure Weeks^2 Weeks^3 Weeks^4 Weeks^5


Regression Statistics
(Weeks) Total Cars Sold
Multiple R 0.963462458
168 28224 4741632 796594176 1.33828E+11 272
R Square 0.928259907
428 183184 78402752 33556377856 1.43621E+13 300
Adjusted R Square 0.8884043
Standard Error 33.23101012
296 87616 25934336 7676563456 2.27226E+12 311
392 153664 60236288 23612624896 9.25615E+12 365
Observations 15
80 6400 512000 40960000 3276800000 167
56 3136 175616 9834496 550731776 149
  Coefficients Standard Error t Stat P-value
Intercept 59.86996928 33.93766826 1.764116 0.111537
352 123904 43614208 15352201216 5.40397E+12 366
Job Tenure (Weeks) 1.837026755 1.656733541 1.108825 0.296255 444 197136 87528384 38862602496 1.7255E+13 310
Weeks^2 -0.007528853 0.026022175 -0.28932 0.778887 168 28224 4741632 796594176 1.33828E+11 192
Weeks^3 1.7326E-05 0.000162108 0.106879 0.91723 200 40000 8000000 1600000000 3.2E+11 229
Weeks^4 6.25025E-09 4.22349E-07 0.014799 0.988516 4 16 64 256 1024 88
Weeks^5 -4.95251E-11 3.86666E-10 -0.12808 0.9009 52 2704 140608 7311616 380204032 118
20 400 8000 160000 3200000 62
228 51984 11852352 2702336256 6.16133E+11 319
72 5184 373248 26873856 1934917632 193
P value > α
Quintic Polynomial
Job Tenure (Weeks) Line Fit Plot
400

350

300

250
Total Cars Sold

Total Cars Sold


200 Predicted Total Cars Sold
Polynomial (Predicted Total Cars Sold)

150

100  

50

0
0 50 100 150 200 250 300 350 400 450 500

Job Tenure (Weeks)

You might also like