library(readr)
NBA <- read.csv("Miami Dade College/2024/Summer 2024/CAP4936 Special Topics in Data Analytics/NBA_train.csv")
View(NBA)
# Linear regression model for points scored
PointsReg = lm(PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + TOV + STL + BLK, data=NBA)
summary(PointsReg)
Call:
lm(formula = PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + TOV +
STL + BLK, data = NBA)
Residuals:
Min 1Q Median 3Q Max
-527.40 -119.83 7.83 120.67 564.71
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.051e+03 2.035e+02 -10.078 <2e-16 ***
X2PA 1.043e+00 2.957e-02 35.274 <2e-16 ***
X3PA 1.259e+00 3.843e-02 32.747 <2e-16 ***
FTA 1.128e+00 3.373e-02 33.440 <2e-16 ***
AST 8.858e-01 4.396e-02 20.150 <2e-16 ***
ORB -9.554e-01 7.792e-02 -12.261 <2e-16 ***
DRB 3.883e-02 6.157e-02 0.631 0.5285
TOV -2.475e-02 6.118e-02 -0.405 0.6859
STL -1.992e-01 9.181e-02 -2.169 0.0303 *
BLK -5.576e-02 8.782e-02 -0.635 0.5256
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 185.5 on 825 degrees of freedom
Multiple R-squared: 0.8992, Adjusted R-squared: 0.8981
F-statistic: 817.3 on 9 and 825 DF, p-value: < 2.2e-16
The linear regression shows that the variables 2PA, 3PA, FTA, and AST positively impact the points scored by NBA teams. On the other hand, ORB is negatively significant because it has a negative coefficient. These other variables (DRB, TOV, BLK) are insignificant predictors. The model explains 89.9% of the variance in points scored. The model is good but we can still improve it removing variablels.
# Sum of Squared Errors
PointsReg$residuals
1 2 3 4 5 6 7 8 9
38.5722713 142.8720040 -92.8957180 -8.3913473 -258.4705615 171.4608325 150.4081623 169.3811429 40.7756197
10 11 12 13 14 15 16 17 18
-75.3256614 444.9088743 94.3864704 -205.6809050 113.5969040 64.1993998 -76.5711999 249.4888007 28.0363236
19 20 21 22 23 24 25 26 27
329.4487991 96.3248342 349.2067913 -284.3765225 196.1611379 198.2493104 445.4100295 93.8946072 -316.2962802
28 29 30 31 32 33 34 35 36
-166.1909668 -5.8446359 211.2301997 155.7426615 -23.9248929 -77.9070033 218.9449693 164.1368602 -177.6479438
37 38 39 40 41 42 43 44 45
66.9205988 162.7892553 23.5961895 93.9839603 185.7015113 -50.2507837 -90.1181969 139.6866673 -231.1772776
46 47 48 49 50 51 52 53 54
111.2200135 185.9069491 210.6753018 -47.9420913 -257.8213675 225.7399197 70.4925628 432.6468031 187.4169561
55 56 57 58 59 60 61 62 63
-34.3947653 112.9305359 334.4717296 222.4169937 17.6755711 165.4512882 207.9970351 56.8277093 214.6051983
64 65 66 67 68 69 70 71 72
-23.0235142 341.7509536 -48.3807695 304.9203623 -36.7878762 -31.0357805 61.8847883 -153.0322403 121.7423324
73 74 75 76 77 78 79 80 81
-61.1581185 -47.9906548 -120.3599484 245.7621368 -264.3876116 161.1110819 87.3192423 426.2098591 -4.7790973
82 83 84 85 86 87 88 89 90
126.8613801 -97.5009340 329.9773912 -16.2338716 7.8513505 191.9280982 87.0090318 -142.5397602 -216.2264974
91 92 93 94 95 96 97 98 99
-199.6293933 71.0810742 257.3751407 -227.1203824 -61.4866232 71.3329444 -233.2637272 -34.7860771 84.9503466
100 101 102 103 104 105 106 107 108
108.6553543 -84.8168235 -90.0423121 341.2144522 52.8507112 47.8978397 181.0574099 160.7203318 237.0174702
109 110 111 112 113 114 115 116 117
314.9609845 51.9650831 300.2035074 -148.0931149 -13.3592416 -161.6184704 82.1172789 277.6080699 233.4334153
118 119 120 121 122 123 124 125 126
-225.7299932 69.0259972 37.3407430 18.2709681 121.8125335 217.9464858 -74.8210467 36.2611001 356.2366230
127 128 129 130 131 132 133 134 135
439.4127892 111.0266627 72.1377278 -6.1141295 331.6249450 -158.3642350 94.9048994 151.3242943 -284.7768411
136 137 138 139 140 141 142 143 144
-184.0287416 -103.9972773 54.1758237 139.3176593 125.3796164 -71.4407602 83.4742245 -131.6383234 -33.5752771
145 146 147 148 149 150 151 152 153
98.9460909 -59.8760139 -116.6711077 -110.4055752 290.8888709 38.5758792 -6.8265554 -284.8106013 149.5419209
154 155 156 157 158 159 160 161 162
-185.9270381 -13.5712897 -90.2301662 21.0080300 14.5295957 -346.4091267 -54.7198161 87.6823846 203.7903006
163 164 165 166 167 168 169 170 171
-30.7131853 -153.9699795 194.6791232 -357.4466727 133.8696823 -21.6271760 -220.4987354 -153.7269937 -383.7168614
172 173 174 175 176 177 178 179 180
212.2104185 -100.3118791 -30.5085767 -57.7910608 205.9463003 -124.1358862 -61.2169391 -93.9538879 -135.6180284
181 182 183 184 185 186 187 188 189
69.1245169 -435.5355494 -47.8153585 115.1051439 222.5411686 104.6516380 7.8335700 178.0759383 -185.3383423
190 191 192 193 194 195 196 197 198
122.0537263 -29.4729351 27.1344203 189.2078833 -429.5919872 57.2397301 -170.2701567 -14.0836520 21.0147294
199 200 201 202 203 204 205 206 207
49.6548689 -127.4633821 -87.4084020 -77.6940715 -155.2913076 8.4930328 -232.7210528 35.3384277 151.1394532
208 209 210 211 212 213 214 215 216
119.4563308 -416.3088878 134.8599211 33.3825347 48.4541197 -269.8021487 214.9045443 88.1318416 -24.0318730
217 218 219 220 221 222 223 224 225
188.2281015 -249.1537666 157.9872056 -146.6803006 72.9077663 31.1747176 337.2185582 69.7227713 -2.7440511
226 227 228 229 230 231 232 233 234
-55.2845827 -84.6255409 -151.4858821 234.7432200 -165.3909069 -172.9288404 386.6402387 34.4884530 -368.0387956
235 236 237 238 239 240 241 242 243
304.8349400 -173.0591889 168.9365987 -327.6509605 95.0370278 -75.5698743 -74.9702316 290.0371682 -21.8628806
244 245 246 247 248 249 250 251 252
72.5362398 -144.3565453 -44.7765529 -155.4752429 -114.0232742 82.8841506 -306.5759686 256.9630856 75.4312937
253 254 255 256 257 258 259 260 261
-108.9852622 -160.6985087 -1.0708625 389.4834173 48.4039145 -173.2376267 102.4859575 564.7127452 -135.6781765
262 263 264 265 266 267 268 269 270
435.5847710 -238.8763852 93.4120332 -346.4790813 84.2266238 124.2627684 157.9013909 90.9742388 -319.7738668
271 272 273 274 275 276 277 278 279
111.6330940 -136.0189613 179.6895020 -139.8481361 -60.2214721 21.1448936 -102.4930752 87.4261255 -2.2833983
280 281 282 283 284 285 286 287 288
-33.1839059 -313.4181662 -9.7903234 365.0041757 -170.9089658 -203.2682115 -59.0783300 344.4592952 -177.2934555
289 290 291 292 293 294 295 296 297
278.4424923 31.1539516 -19.4217087 146.9309508 49.6437593 323.4485389 47.1034178 3.9718411 -111.0589062
298 299 300 301 302 303 304 305 306
-40.0036081 187.1994351 134.5701059 -130.3795390 227.3624370 16.4481298 -91.2556101 215.9887998 70.7747666
307 308 309 310 311 312 313 314 315
50.5357552 -86.7616664 66.3006293 348.5847817 69.7928527 -144.9174008 48.2485248 262.5189212 -11.0182067
316 317 318 319 320 321 322 323 324
276.2567984 40.2609782 -235.0009787 91.8230888 -36.7029055 66.1862316 127.1446887 34.6306466 -89.1508242
325 326 327 328 329 330 331 332 333
-38.0350890 74.6959695 -24.6713632 -139.6322463 120.5781319 -256.3194253 35.3325803 -238.1863124 204.2701943
334 335 336 337 338 339 340 341 342
-231.4333870 -242.0178081 27.3589769 442.7697537 -90.3428846 -252.6536092 31.2460678 -24.0030042 -113.6697991
343 344 345 346 347 348 349 350 351
74.2030422 -63.3601223 13.1314540 -58.4065092 16.5093336 -26.4233092 -49.9197611 102.5295504 -276.0762358
352 353 354 355 356 357 358 359 360
-171.2605451 235.4118705 -295.3696087 -259.1915277 -209.8493128 -60.3803252 40.8738668 -162.3559100 -3.1584146
361 362 363 364 365 366 367 368 369
-252.6683460 -359.6072976 219.8480950 107.9177034 -228.4285961 77.5838841 77.6092501 176.9728823 21.0277939
370 371 372 373 374 375 376 377 378
225.7947949 90.6177409 -95.0387148 243.8004275 63.7765295 -135.7112041 127.9942080 208.5134149 -226.2507886
379 380 381 382 383 384 385 386 387
-27.4427262 215.5791874 70.0554598 -220.3324085 -252.5213694 -117.0224660 36.9146043 188.5932206 -12.6241171
388 389 390 391 392 393 394 395 396
24.1401960 39.4113815 130.8261623 194.8028770 140.1603242 100.4917058 367.8120506 -77.1138759 190.1907177
397 398 399 400 401 402 403 404 405
430.4505906 243.1092461 -220.7690501 -135.3500281 182.9169784 58.1314347 -10.3705665 134.0505987 333.4363828
406 407 408 409 410 411 412 413 414
110.9704334 37.1431301 188.8559358 -88.4445131 -165.3268990 148.8624801 -4.7914163 -114.6045335 -90.1562962
415 416 417 418 419 420 421 422 423
-65.1353805 9.9207366 -20.2393315 147.7163583 153.4474395 95.5889698 -329.6439893 323.3019593 345.3838501
424 425 426 427 428 429 430 431 432
-148.5288812 166.9648145 277.3541861 162.6383840 -78.9033000 -176.7932426 365.3962572 132.7242544 85.6582953
433 434 435 436 437 438 439 440 441
-19.3417988 95.4767236 -102.8199452 111.8183778 299.2808339 -124.0889739 -37.3805041 118.5055640 38.2173450
442 443 444 445 446 447 448 449 450
-122.8141423 -84.3447659 154.5643586 42.6355711 54.7178397 102.9846564 32.6861086 112.7943954 -163.3563028
451 452 453 454 455 456 457 458 459
150.7521084 217.5877806 -96.7133626 13.7243484 -33.1690450 -112.2550008 -15.7083565 -224.4198990 18.2593593
460 461 462 463 464 465 466 467 468
-393.0403979 49.2945267 52.0947949 43.2496203 -149.1223107 75.6856970 170.8878792 -257.6364448 51.6854016
469 470 471 472 473 474 475 476 477
11.8121415 -176.9048352 -149.5317630 -64.1990241 -71.3105611 -317.9190063 -65.8451642 97.8497015 -103.1692986
478 479 480 481 482 483 484 485 486
3.0848318 -104.6823532 -234.7534874 50.5295490 -75.4835788 -526.1468848 -393.9784124 -360.8366411 116.7193515
487 488 489 490 491 492 493 494 495
-321.3756304 -28.1090479 -508.3250405 -39.9958738 67.9854387 -97.4641720 -268.8364479 -26.0249946 188.1881640
496 497 498 499 500 501 502 503 504
-127.9366821 -86.3440758 133.8144538 29.4480488 -292.9821609 -124.9408024 101.3655240 -186.5181083 -63.5389375
505 506 507 508 509 510 511 512 513
-212.2015589 -323.1476886 -125.6610320 56.9083106 -39.0559074 -1.9339391 -319.9727619 -433.1243358 -431.1346590
514 515 516 517 518 519 520 521 522
-95.8909016 120.6089792 -409.7409083 -352.9341830 -527.3988939 110.6694955 -193.5043557 -92.6385367 -143.5858243
523 524 525 526 527 528 529 530 531
-189.7838251 172.1977457 -80.8020663 -342.9141699 124.8700974 -226.9524006 -73.5173798 -388.4868649 82.9536394
532 533 534 535 536 537 538 539 540
-96.7444961 -114.0835553 60.0566113 -332.3804023 -175.5276633 -338.7116370 -148.1422366 -45.2258816 -270.5159099
541 542 543 544 545 546 547 548 549
-159.8389177 -420.4637398 -133.0466450 183.8988039 -267.0297916 -5.2562902 -228.0471046 -11.6818058 -255.6786897
550 551 552 553 554 555 556 557 558
-7.7244412 -115.5357863 -298.4118693 -122.2961876 90.2924072 111.3930340 -245.4519945 -164.6445508 -29.3651223
559 560 561 562 563 564 565 566 567
-41.9781581 33.4260937 15.1663563 -29.4557965 44.0659204 247.9836928 -57.4318280 -238.6989443 -8.7249850
568 569 570 571 572 573 574 575 576
30.9454288 -343.6175905 -207.4418486 -306.4223254 157.4538406 -502.4785715 -126.1415717 48.8616098 143.9835801
577 578 579 580 581 582 583 584 585
-344.7694076 -116.5012114 -142.7898454 -127.9612584 -226.7659179 67.1679765 -94.0443422 -326.2414346 -84.6517620
586 587 588 589 590 591 592 593 594
4.5942017 -89.9757406 -97.0958454 -34.6927947 40.9701699 -88.3066869 126.5679875 -128.7529512 -166.6757304
595 596 597 598 599 600 601 602 603
-208.2444446 -105.4053449 -69.9961388 -104.0297252 -475.1678378 -290.6421238 195.4801727 -116.0865727 -136.0505114
604 605 606 607 608 609 610 611 612
-118.3811054 125.8235124 -145.2484421 -144.5655628 -435.6270621 -230.6201428 -112.7403208 -243.8883351 13.9124625
613 614 615 616 617 618 619 620 621
-392.1393056 -233.5727670 88.6125994 -203.7574893 -207.3393547 36.7326516 71.7237279 -110.6124268 -151.5524839
622 623 624 625 626 627 628 629 630
95.2365977 -227.3589026 -98.5962165 -210.8715081 -53.6787512 33.2644764 -380.2334407 -217.0512157 -135.7283167
631 632 633 634 635 636 637 638 639
208.5947156 -198.2473902 -147.6362401 -282.5390059 -55.4726214 3.0618526 -118.7764165 -15.9756605 1.5396468
640 641 642 643 644 645 646 647 648
2.2068206 -78.5559489 20.5194552 -376.9064555 -367.5790965 78.4730898 88.0528050 -178.9859105 283.6342652
649 650 651 652 653 654 655 656 657
18.0639226 1.4275017 -22.1910648 334.1581029 -44.6704981 -166.2133428 -112.8182784 175.7515262 60.9355144
658 659 660 661 662 663 664 665 666
-331.2815975 -175.1322112 34.9727118 430.8913232 -260.7815266 -99.5985786 -306.5331420 -144.2463445 -71.9561309
667 668 669 670 671 672 673 674 675
40.4095734 -9.9170555 9.7141807 72.8730721 -61.2840291 -51.9936086 -452.8596863 -81.9437393 69.2906290
676 677 678 679 680 681 682 683 684
254.7395766 -22.9459505 215.8931262 -16.9537293 -107.9068394 202.3017464 287.5765859 180.7757394 -305.5932029
685 686 687 688 689 690 691 692 693
56.2240459 4.5320328 -44.0648823 -278.0391307 -13.3280981 -112.7276708 422.1750569 -131.0023955 51.4971549
694 695 696 697 698 699 700 701 702
-86.9745423 28.8396258 -107.9302127 -55.3683153 -16.7225380 60.3453436 3.3520616 140.9429255 -17.9219329
703 704 705 706 707 708 709 710 711
-296.8381962 136.2394242 106.7244264 168.2861008 26.7860625 339.8954937 187.8922770 -202.6392008 148.7995083
712 713 714 715 716 717 718 719 720
268.8921528 0.6597544 -119.2916116 -23.0549542 -28.1758366 206.7679556 -138.5838793 -210.7824121 -29.6626073
721 722 723 724 725 726 727 728 729
210.3268820 -212.8798945 88.1962039 129.1032851 11.9530477 -166.3796048 -372.3297260 67.5130804 1.7122210
730 731 732 733 734 735 736 737 738
-179.0745146 -28.4404659 151.2765881 -425.3360446 344.3671825 -47.2592021 136.9801455 63.4427397 203.2044716
739 740 741 742 743 744 745 746 747
27.7908779 251.4279736 84.5817590 -155.6577645 150.3787715 138.7921016 198.4699948 101.8590582 345.8144412
748 749 750 751 752 753 754 755 756
35.1336113 169.1641149 354.9998851 251.7571721 47.8412497 77.9677328 66.2799291 216.7990909 155.1577399
757 758 759 760 761 762 763 764 765
-131.2437994 230.2449071 218.7156645 116.0349148 -78.5937100 -23.1321308 99.7713990 280.2227149 40.8527845
766 767 768 769 770 771 772 773 774
19.4188914 72.9388151 120.7266716 439.1035137 456.0100354 47.3239201 186.1096824 31.7505381 -54.0912550
775 776 777 778 779 780 781 782 783
73.0035369 234.4761589 27.9146721 -21.6493313 -75.0167664 148.4251726 106.3308316 76.0196340 37.3592068
784 785 786 787 788 789 790 791 792
56.5562663 -41.8917486 -200.7598142 -55.5159544 109.1518868 321.3239680 219.8866600 -73.6034103 3.1961900
793 794 795 796 797 798 799 800 801
-171.1408177 190.8979178 101.1845265 253.1734885 263.7840087 199.5924560 463.8379676 219.1540922 52.3032317
802 803 804 805 806 807 808 809 810
140.7498122 195.8267787 -55.3103142 153.8564182 61.1275837 92.8158603 -108.8302808 73.3423661 -360.6001538
811 812 813 814 815 816 817 818 819
134.1518035 73.3435884 141.0017271 272.8259956 -33.1611977 19.7818711 -149.9998706 190.0065593 261.3992751
820 821 822 823 824 825 826 827 828
308.7602526 -135.4172110 108.2677094 -171.3410196 102.4439076 156.0829202 210.0521687 109.4908936 -20.5354175
829 830 831 832 833 834 835
59.2845716 175.9235274 30.6531825 262.6728011 70.0671862 -17.5789419 -8.3393046
SSE = sum(PointsReg$residuals^2)
SSE
[1] 28394314
# Root mean squared error
RMSE = sqrt(SSE/nrow(NBA))
RMSE
[1] 184.4049
The model’s RMSE is 184.4049, which indicates that the predicted points scored by the model, on average, differ from the actual points by about 1844 points. This shows that the model’s predictions could need an improvement to increase the accuracy.
# Average number of points in a season
mean(NBA$PTS)
[1] 8370.24
The average number of points scored by NBA teams in a season is 8,370.24.
# Remove insignifcant variables
summary(PointsReg)
Call:
lm(formula = PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + TOV +
STL + BLK, data = NBA)
Residuals:
Min 1Q Median 3Q Max
-527.40 -119.83 7.83 120.67 564.71
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.051e+03 2.035e+02 -10.078 <2e-16 ***
X2PA 1.043e+00 2.957e-02 35.274 <2e-16 ***
X3PA 1.259e+00 3.843e-02 32.747 <2e-16 ***
FTA 1.128e+00 3.373e-02 33.440 <2e-16 ***
AST 8.858e-01 4.396e-02 20.150 <2e-16 ***
ORB -9.554e-01 7.792e-02 -12.261 <2e-16 ***
DRB 3.883e-02 6.157e-02 0.631 0.5285
TOV -2.475e-02 6.118e-02 -0.405 0.6859
STL -1.992e-01 9.181e-02 -2.169 0.0303 *
BLK -5.576e-02 8.782e-02 -0.635 0.5256
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 185.5 on 825 degrees of freedom
Multiple R-squared: 0.8992, Adjusted R-squared: 0.8981
F-statistic: 817.3 on 9 and 825 DF, p-value: < 2.2e-16
PointsReg2 = lm(PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + STL + BLK, data=NBA)
summary(PointsReg2)
When we removed an insignificant variable, OVT, there was still a decent model with an R-squared of 89.91%. However, there are still significant variables. Variables such as DRB and BLK remain insignificant.
PointsReg3 = lm(PTS ~ X2PA + X3PA + FTA + AST + ORB + STL + BLK, data=NBA)
summary(PointsReg3)
Call:
lm(formula = PTS ~ X2PA + X3PA + FTA + AST + ORB + STL + BLK,
data = NBA)
Residuals:
Min 1Q Median 3Q Max
-523.79 -121.64 6.07 120.81 573.64
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.015e+03 1.670e+02 -12.068 < 2e-16 ***
X2PA 1.048e+00 2.852e-02 36.753 < 2e-16 ***
X3PA 1.271e+00 3.475e-02 36.568 < 2e-16 ***
FTA 1.128e+00 3.270e-02 34.506 < 2e-16 ***
AST 8.909e-01 4.326e-02 20.597 < 2e-16 ***
ORB -9.702e-01 7.519e-02 -12.903 < 2e-16 ***
STL -2.276e-01 8.356e-02 -2.724 0.00659 **
BLK -3.882e-02 8.165e-02 -0.475 0.63462
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 185.4 on 827 degrees of freedom
Multiple R-squared: 0.8991, Adjusted R-squared: 0.8982
F-statistic: 1053 on 7 and 827 DF, p-value: < 2.2e-16
This updated regression model (PointsReg3) is still a strong model, with an R-squared of 89.91%. All the variables are significant except blocks (BLK). It makes sense that when we are talking about scoring points, throws don’t have an impact because we are talking about offense.
PointsReg4 = lm(PTS ~ X2PA + X3PA + FTA + AST + ORB + STL, data=NBA)
summary(PointsReg4)
Call:
lm(formula = PTS ~ X2PA + X3PA + FTA + AST + ORB + STL, data = NBA)
Residuals:
Min 1Q Median 3Q Max
-523.33 -122.02 6.93 120.68 568.26
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.033e+03 1.629e+02 -12.475 < 2e-16 ***
X2PA 1.050e+00 2.829e-02 37.117 < 2e-16 ***
X3PA 1.273e+00 3.441e-02 37.001 < 2e-16 ***
FTA 1.127e+00 3.260e-02 34.581 < 2e-16 ***
AST 8.884e-01 4.292e-02 20.701 < 2e-16 ***
ORB -9.743e-01 7.465e-02 -13.051 < 2e-16 ***
STL -2.268e-01 8.350e-02 -2.717 0.00673 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 185.3 on 828 degrees of freedom
Multiple R-squared: 0.8991, Adjusted R-squared: 0.8983
F-statistic: 1229 on 6 and 828 DF, p-value: < 2.2e-16
This model explains 89.91% of the variability in scoring. All the predictors have PVs, indicating their contributions are statistically significant to the model. This means we removed the insignificant ones; this last version is an effective model.
# Compute SSE and RMSE for new model
SSE_4 = sum(PointsReg4$residuals^2)
RMSE_4 = sqrt(SSE_4/nrow(NBA))
SSE_4
[1] 28421465
RMSE_4
[1] 184.493
The SSE is 28421465, and the RMSE is approximately 184.493. Baiscally we keep to the same amoun of error.