getwd()
[1] "/cloud/project"

In Class Activity 12

# VIDEO 1

# Read in the data
NBA = read.csv("NBA_train.csv")
str(NBA)
'data.frame':   835 obs. of  20 variables:
 $ SeasonEnd: int  1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 ...
 $ Team     : chr  "Atlanta Hawks" "Boston Celtics" "Chicago Bulls" "Cleveland Cavaliers" ...
 $ Playoffs : int  1 1 0 0 0 0 0 1 0 1 ...
 $ W        : int  50 61 30 37 30 16 24 41 37 47 ...
 $ PTS      : int  8573 9303 8813 9360 8878 8933 8493 9084 9119 8860 ...
 $ oppPTS   : int  8334 8664 9035 9332 9240 9609 8853 9070 9176 8603 ...
 $ FG       : int  3261 3617 3362 3811 3462 3643 3527 3599 3639 3582 ...
 $ FGA      : int  7027 7387 6943 8041 7470 7596 7318 7496 7689 7489 ...
 $ X2P      : int  3248 3455 3292 3775 3379 3586 3500 3495 3551 3557 ...
 $ X2PA     : int  6952 6965 6668 7854 7215 7377 7197 7117 7375 7375 ...
 $ X3P      : int  13 162 70 36 83 57 27 104 88 25 ...
 $ X3PA     : int  75 422 275 187 255 219 121 379 314 114 ...
 $ FT       : int  2038 1907 2019 1702 1871 1590 1412 1782 1753 1671 ...
 $ FTA      : int  2645 2449 2592 2205 2539 2149 1914 2326 2333 2250 ...
 $ ORB      : int  1369 1227 1115 1307 1311 1226 1155 1394 1398 1187 ...
 $ DRB      : int  2406 2457 2465 2381 2524 2415 2437 2217 2326 2429 ...
 $ AST      : int  1913 2198 2152 2108 2079 1950 2028 2149 2148 2123 ...
 $ STL      : int  782 809 704 764 746 783 779 782 900 863 ...
 $ BLK      : int  539 308 392 342 404 562 339 373 530 356 ...
 $ TOV      : int  1495 1539 1684 1370 1533 1742 1492 1565 1517 1439 ...
View(NBA)
# VIDEO 2

# How many wins to make the playoffs?

# Teams should win atleast 38 games to make it to the playoffs

table(NBA$W, NBA$Playoffs)
    
      0  1
  11  2  0
  12  2  0
  13  2  0
  14  2  0
  15 10  0
  16  2  0
  17 11  0
  18  5  0
  19 10  0
  20 10  0
  21 12  0
  22 11  0
  23 11  0
  24 18  0
  25 11  0
  26 17  0
  27 10  0
  28 18  0
  29 12  0
  30 19  1
  31 15  1
  32 12  0
  33 17  0
  34 16  0
  35 13  3
  36 17  4
  37 15  4
  38  8  7
  39 10 10
  40  9 13
  41 11 26
  42  8 29
  43  2 18
  44  2 27
  45  3 22
  46  1 15
  47  0 28
  48  1 14
  49  0 17
  50  0 32
  51  0 12
  52  0 20
  53  0 17
  54  0 18
  55  0 24
  56  0 16
  57  0 23
  58  0 13
  59  0 14
  60  0  8
  61  0 10
  62  0 13
  63  0  7
  64  0  3
  65  0  3
  66  0  2
  67  0  4
  69  0  1
  72  0  1
# Compute Points Difference
NBA$PTSdiff = NBA$PTS - NBA$oppPTS
print(NBA$PTSdiff)
  [1]   239   639  -222    28  -362  -676  -360    14   -57   257   484   323   -96   -94   346   295   -67   -31
 [19]  -340   382  -493  -209  -254   482   162  -398  -689   -39  -518   -97    27   115     1   315   596  -494
 [37]   133   644   452    73   236  -130  -135  -483     1    44   523  -166  -698  -363    43   -75    85    -3
 [55]  -153  -254   399   449    56  -219   470   283    49   189  -606   339  -464    72   -78   439  -401  -610
 [73]   -34    51   -33  -297  -951  -480   119   455   361   227   201   629   415   175   300  -396   263  -344
 [91]   -11  -106   538  -425  -349    35   -90   294  -279  -253  -395  -121   308   341    90   315   180    73
[109]   291   -22  -267   -14    93  -237  -119   545   -69  -226   178   200   204  -602   141  -509  -219  -368
[127]   603   562    19  -380   336  -173   279    75  -446    -9   -22   194   772  -312  -235    90   107    96
[145]  -283   214  -273  -568   635   741  -163  -460   193  -245    87  -252  -152    -8   -30  -148   593   545
[163]    73  -313   517   -71   282  -192    82   -53  -937   763   321  -414  -514   -16  -200   257  -264  -418
[181]    38    33  -112   295   487   279    62   358   334   424  -682   114   -65  -846   479    44  -665   -40
[199]  -118  -367   371  -472  -400   169   302   -63   403    95  -699   118   623   -99   139   476   -25    78
[217]  -342  -813   588  -921   296  -521   309   123   631   120  -455  -597   238   412  -177    84   327  -641
[235]   267   -25     6   116   499  -257   120    13  -278   556  -797   -64  -347  -645   116  -731   409   582
[253]   518  -415   286    85   393  -177    63   477  -430   746  -202  -375  -895   268   134   287   -32  -283
[271]   553  -491   203  -322  -370   -19  -326   -15   537   712  -556   370   101   273  -408  -123   297  -320
[289]   856   447  -627  -645   167   320  -141   155    88   -90  -345  -140  -578  -139   319  -567  -104   487
[307]   596  -497   272   154   524  -366   -71    73   -20   516   529 -1246  -143  -114   -81   347   139    29
[325]  -104   -94  -306  -638   103   505   108  -473   546   255  -260   219   580   178  -577   432  -351   -18
[343]   253   330  -713   122  -638   143   354   283  -469  -352   219  -531  -568   180   573   319  -625   397
[361]   216  -473   431   745   346  -605   105  -154   269   396    51  -238    69  -598  -444   174   303  -751
[379]   -18  -134  -358  -738  -257   255   579  -416   318   313   -82   489   671   655  -459   100  -279   -47
[397]  1004   212  -402  -222   205  -119   143   266  -295   365   117  -435  -439  -347   190   456  -820    27
[415]   193  -222   517   639  -616   540  -818    87   446  -601   153   886   151  -521  -515   430  -386   367
[433]    80  -193   350   450  -155  -121  -374   256   -29  -536    54   342  -277  -646   630  -256   721  -839
[451]   133   288  -215   164   583   224  -501  -966   129  -748   -62   499  -604   635   404  -157    58   129
[469]   202   -88  -196   425   115  -458   327   588  -760   536  -599    48  -441   -62   219  -771  -287   -47
[487]  -174   118  -678   -71   377  -945   701   255    18   207   -85   120    56   110   428   525   239   487
[505]    78   -13   366  -461  -269  -427  -175   172  -746  -348   351  -202  -139  -742   188   -16  -237   277
[523]   188   318   111  -414   216    81   351   181   344   477   636     2   185   385  -470  -547  -347   181
[541]    79  -700  -273   349  -477   175  -443  -401    22   -38   584  -610  -126   -18   277   341  -327   129
[559]   131   -56   245   624   509   248   -36    73  -115  -292   -32  -421  -789   638  -679   302   -93   121
[577]   286  -338   191  -265  -414    19   170   428   173  -111    11   189    93   214   533   444   -10  -481
[595]   196   -83  -381  -119  -521  -215   364    88   479   -60   142   472  -376   320   200    43    87   450
[613]   205    -8  -121  -576  -204  -307  -104   411   592   -52  -247  -100  -462  -796    71  -491    87    65
[631]   471   166   317  -177   331    62   -63  -243   188   535  -245   119  -123  -580  -200  -184   -61   584
[649]  -328   177   640   188  -133  -350   -27  -390  -126  -328    52   183   498    19   547  -111  -130   155
[667]   129   205   303   317   -85  -154   112  -231  -525   -88  -160   455  -775   126   559  -248  -245  -216
[685]   152  -390  -280  -307   411   314   592   133   341   -28   398  -200   -38    -6  -422   -75  -359  -301
[703]   -63  -129  -234    64  -248   599  -352  -148   691  -237    81   235   -42  -149   841  -359  -253   -29
[721]   372   304   606   181   384  -115  -596   595  -509  -709  -565  -556  -415   433  -542   448    34   414
[739]   -80  -185   393  -718   238   564   -27   129   616  -104   -23   732   162   280   -40  -307   328   -91
[757]  -719   628  -448    21   -89  -403  -200   127  -214  -500   549     6   158   438  -718   308  -231   217
[775]  -612   382   300   120  -134   535   223   335  -419  -295   -30  -247  -521   387  -124   187   139  -787
[793]  -748  -202  -313   286   614  -320   402   271  -358   417  -146   438  -392   -67   440  -328   600  -739
[811]   347   390  -295  -191   179   -88  -257   501   192   612   -69  -544  -512    73    64   311   448   123
[829]   -73   125  -438   468  -515  -150  -607
# Check for linear relationship
plot(NBA$PTSdiff, NBA$W)

# Linear regression model for wins
WinsReg = lm(W ~ PTSdiff, data=NBA)
summary(WinsReg)

Call:
lm(formula = W ~ PTSdiff, data = NBA)

Residuals:
    Min      1Q  Median      3Q     Max 
-9.7393 -2.1018 -0.0672  2.0265 10.6026 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 4.100e+01  1.059e-01   387.0   <2e-16 ***
PTSdiff     3.259e-02  2.793e-04   116.7   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.061 on 833 degrees of freedom
Multiple R-squared:  0.9423,    Adjusted R-squared:  0.9423 
F-statistic: 1.361e+04 on 1 and 833 DF,  p-value: < 2.2e-16
# VIDEO 3

# 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
# 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
summary(NBA$PTS)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   6901    7934    8312    8370    8784   10371 
# Root mean squared error
RMSE = sqrt(SSE/nrow(NBA))
RMSE
[1] 184.4049
# Average number of points in a season
mean(NBA$PTS)
[1] 8370.24
# Remove insignificant 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
# TOV were dropped - not significant
PointsReg2 = lm(PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + STL + BLK, data=NBA)
summary(PointsReg2)

Call:
lm(formula = PTS ~ X2PA + X3PA + FTA + AST + ORB + DRB + STL + 
    BLK, data = NBA)

Residuals:
    Min      1Q  Median      3Q     Max 
-526.79 -121.09    6.37  120.74  565.94 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -2.077e+03  1.931e+02 -10.755   <2e-16 ***
X2PA         1.044e+00  2.951e-02  35.366   <2e-16 ***
X3PA         1.263e+00  3.703e-02  34.099   <2e-16 ***
FTA          1.125e+00  3.308e-02  34.023   <2e-16 ***
AST          8.861e-01  4.393e-02  20.173   <2e-16 ***
ORB         -9.581e-01  7.758e-02 -12.350   <2e-16 ***
DRB          3.892e-02  6.154e-02   0.632   0.5273    
STL         -2.068e-01  8.984e-02  -2.301   0.0216 *  
BLK         -5.863e-02  8.749e-02  -0.670   0.5029    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 185.4 on 826 degrees of freedom
Multiple R-squared:  0.8991,    Adjusted R-squared:  0.8982 
F-statistic: 920.4 on 8 and 826 DF,  p-value: < 2.2e-16
# DRB were dropped - not significant
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
# BLK were dropped - not significant
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
# 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
# VIDEO 4

# Read in test set
NBA_test = read.csv("NBA_test.csv")
str(NBA_test)
'data.frame':   28 obs. of  20 variables:
 $ SeasonEnd: int  2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 ...
 $ Team     : chr  "Atlanta Hawks" "Brooklyn Nets" "Charlotte Bobcats" "Chicago Bulls" ...
 $ Playoffs : int  1 1 0 1 0 0 1 0 1 1 ...
 $ W        : int  44 49 21 45 24 41 57 29 47 45 ...
 $ PTS      : int  8032 7944 7661 7641 7913 8293 8704 7778 8296 8688 ...
 $ oppPTS   : int  7999 7798 8418 7615 8297 8342 8287 8105 8223 8403 ...
 $ FG       : int  3084 2942 2823 2926 2993 3182 3339 2979 3130 3124 ...
 $ FGA      : int  6644 6544 6649 6698 6901 6892 6983 6638 6840 6782 ...
 $ X2P      : int  2378 2314 2354 2480 2446 2576 2818 2466 2472 2257 ...
 $ X2PA     : int  4743 4784 5250 5433 5320 5264 5465 5198 5208 4413 ...
 $ X3P      : int  706 628 469 446 547 606 521 513 658 867 ...
 $ X3PA     : int  1901 1760 1399 1265 1581 1628 1518 1440 1632 2369 ...
 $ FT       : int  1158 1432 1546 1343 1380 1323 1505 1307 1378 1573 ...
 $ FTA      : int  1619 1958 2060 1738 1826 1669 2148 1870 1744 2087 ...
 $ ORB      : int  758 1047 917 1026 1004 767 1092 991 885 909 ...
 $ DRB      : int  2593 2460 2389 2514 2359 2670 2601 2463 2801 2652 ...
 $ AST      : int  2007 1668 1587 1886 1694 1906 2002 1742 1845 1902 ...
 $ STL      : int  664 599 591 588 647 648 762 574 567 679 ...
 $ BLK      : int  369 391 479 417 334 454 533 400 346 359 ...
 $ TOV      : int  1219 1206 1153 1171 1149 1144 1253 1241 1236 1348 ...
# Make predictions on test set
PointsPredictions = predict(PointsReg4, newdata=NBA_test)
PointsPredictions
       1        2        3        4        5        6        7        8        9       10       11       12       13 
8086.446 7764.143 7965.348 7784.034 8004.349 8247.427 8601.200 7818.223 8127.482 8619.523 8072.525 8535.753 7527.693 
      14       15       16       17       18       19       20       21       22       23       24       25       26 
8022.760 8283.675 8159.595 7507.084 7851.878 8197.481 7766.547 7727.529 7942.718 7947.870 8144.708 8335.840 8006.388 
      27       28 
7975.788 7873.656 
# Compute out-of-sample R^2
SSE = sum((PointsPredictions - NBA_test$PTS)^2)
SST = sum((mean(NBA$PTS) - NBA_test$PTS)^2)
R2 = 1 - SSE/SST
R2
[1] 0.8127142
# Compute the RMSE
RMSE = sqrt(SSE/nrow(NBA_test))
RMSE 
[1] 196.3723

In Class Activity 13

##Our data shows that a team with 49 wins has never missed the playoffs. What is the expected points difference for a team to make it to the postseason? Use the lecture solution file and more specifically the WingsReg model.
##

#WinsReg = lm(W ~ PTSdiff, data=NBA)
#49=41+.0326*(x)
x_1=(49-41)/0.0326
x_1
[1] 245.3988
##Answer:245.3988 is the expected points difference for a team to make it to the postseason**

In Class Activity 14 the three-point attempts

Threepts_made<-c(4, 5, 3, 6, 7)
Threepts_attmpt<-c(9, 10, 8, 11, 12)

#Calculate the three-point shooting percentage for each game 
Three_pts_pct=Threepts_made/Threepts_attmpt
Three_pts_pct
[1] 0.4444444 0.5000000 0.3750000 0.5454545 0.5833333
#select the correct average three-point shooting percentage for the five games.
mean(Three_pts_pct)
[1] 0.4896465
# correct average three-point shooting percentage for the five games is 48.96%
LS0tCnRpdGxlOiAiUGxheWluZyBNb25leWJhbGwgaW4gdGhlIE5CQSIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQpgYGB7cn0KZ2V0d2QoKQpgYGAKKipJbiBDbGFzcyBBY3Rpdml0eSAxMioqCmBgYHtyfQojIFZJREVPIDEKCiMgUmVhZCBpbiB0aGUgZGF0YQpOQkEgPSByZWFkLmNzdigiTkJBX3RyYWluLmNzdiIpCnN0cihOQkEpCmBgYApgYGB7cn0KI1ZpZXcoTkJBKQpgYGAKCmBgYHtyfQojIFZJREVPIDIKCiMgSG93IG1hbnkgd2lucyB0byBtYWtlIHRoZSBwbGF5b2Zmcz8KCiMgVGVhbXMgc2hvdWxkIHdpbiBhdGxlYXN0IDM4IGdhbWVzIHRvIG1ha2UgaXQgdG8gdGhlIHBsYXlvZmZzCgp0YWJsZShOQkEkVywgTkJBJFBsYXlvZmZzKQpgYGAKYGBge3J9CiMgQ29tcHV0ZSBQb2ludHMgRGlmZmVyZW5jZQpOQkEkUFRTZGlmZiA9IE5CQSRQVFMgLSBOQkEkb3BwUFRTCnByaW50KE5CQSRQVFNkaWZmKQpgYGAKYGBge3J9CiMgQ2hlY2sgZm9yIGxpbmVhciByZWxhdGlvbnNoaXAKcGxvd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