In: Statistics and Probability
The data set 2017NBADraft.txt is a comma delimited file containing data on the players selected in the 2017 NBA draft. Assume this data set is a representative sample of all players in the NBA. Correctly import the data set into R.
c) In R, perform a hypothesis test to determine if the mean weights are different for the first round selections and second round selections. To do this, create a new variable so that the first 30 players all have the value of “First” and the second 30 players (observations 31 to 60) have the value of “Second.” Again, state the hypotheses, provide all R output, make a decision and draw a conclusion.
LastName,FirstName,Team,Position,Birthdate,Height,Wingspan,Weight
Fultz,Markelle,76ers,PG,05-29-98,76,81.75,195
Ball,Lonzo,Lakers,PG,10-27-97,78,79,190
Tatum,Jayson,Celtics,SF,03-03-98,80,83,204
Jackson,Josh,Suns,SF,02-10-97,80,81.75,203
Fox,De'Aaron,Kings,PG,12-20-97,76,78.5,171
Isaac,Jonathan,Magic,SF/PF,10-03-97,83,85.25,205
Markkanen,Lauri,Bulls,PF,05-22-97,84,,225
Ntilikina,Frank,Knicks,PG,07-28-98,77,,170
Smith,Dennis,Mavericks,PG,11-25-97,75,75,195
Collins,Zach,Trail Blazers,PF/C,11-19-97,84,85,230
Monk,Malik,Hornets,SG,02-04-98,76,75.5,197
Kennard,Luke,Pistons,SG,06-25-96,78,77.25,202
Mitchell,Donovan,Jazz,SG,09-07-96,75,82,210
Adebayo,Bam,Heat,C,07-18-97,82,86.75,250
Jackson,Justin,Kings,SF,03-28-95,80,83,193
Patton,Justin,Timberwolves,C,06-14-97,84,87,226
Wilson,D.J.,Bucks,PF,02-19-96,82,87,240
Leaf,T.J.,Pacers,PF,04-30-97,82,83,220
Collins,John,Hawks,PF,09-23-97,82,83.25,225
Giles,Harry,Kings,C,04-22-98,83,87.25,222
Ferguson,Terrance,Thunder,SG/SF,05-17-98,79,80.75,186
Allen,Jarrett,Nets,C,04-21-98,83,89.25,224
Anunoby,OG,Raptors,SF/PF,07-17-97,80,86.25,215
Lydon,Tyler,Nuggets,SF/PF,04-09-96,82,84,225
Pasecniks,Anzejs,76ers,C,12-20-95,86,,229
Swanigan,Caleb,Trail Blazers,PF/C,04-18-97,81,87,247
Kuzma,Kyle,Lakers,PF,07-24-95,81,84.25,221
Bradley,Tony,Jazz,C,01-08-98,82,89,248
White,Derrick,Spurs,PG/SG,07-02-94,77,79.5,200
Hart,Josh,Lakers,SG,03-06-95,78,80.25,204
Jackson,Frank,Pelicans,SG,05-04-98,76,79.5,208
Reed,Davon,Suns,SG,06-11-95,78,84,208
Iwundu,Wesley,Magic,SG,12-20-94,79,85,205
Mason,Frank,Kings,PG,04-03-94,71,75.25,185
Rabb,Ivan,Grizzlies,PF/C,02-04-97,82,85.5,215
Bolden,Jonah,76ers,PF,01-02-96,82,,227
Ojeleye,Semi,Celtics,SF/PF,12-05-94,79,81.75,235
Bell,Jordan,Warriors,PF,01-07-95,81,83.75,227
Evans,Juwan,Clippers,PG,07-26-96,73,77.5,177
Bacon,Dwayne,Hornets,SF,08-30-95,77,82,202
Dorsey,Tyler,Hawks,SG,02-14-96,76,77.25,180
Bryant,Thomas,Lakers,C,07-31-97,82,90,241
Hartenstein,Isaiah,Rockets,PF/C,05-05-98,84,86.25,225
Dotson,Damyean,Knicks,SG,05-06-94,77,71,202
Brooks,Dillon,Grizzlies,SF,01-22-96,79,78,215
Brown,Sterling,Bucks,SG,02-10-95,78,81.5,230
Anigbogu,Ike,Pacers,C,10-22-98,82,90.25,230
Thornwell,Sindarius,Clippers,SG,11-15-94,77,82,214
Cancar,Vlatko,Nuggets,PF,04-10-97,80,83,210
Lessort,Mathias,76ers,PF/C,09-29-95,81,,250
Morris,Monte,Nuggets,PG,06-27-95,75,76,175
Sumner,Edmond,Pacers,PG,12-31-95,77,81,170
Allen,Kadeem,Celtics,PG,01-15-93,75,81.25,200
Peters,Alec,Suns,PF,04-13-95,81,82.75,225
Williams-Goss,Nigel,Jazz,PG,09-16-94,76,79.25,182
Bird,Jabari,Celtics,SG,07-03-94,78,80,199
Vezenkov,Aleksandar,Nets,SF/PF,08-06-95,81,,225
Jaramaz,Ognjen,Knicks,PG,09-01-95,76,77.5,193
Blossomgame,Jaron,Spurs,SF/PF,09-16-93,79,82,214
Kaba,Alpha,Hawks,C,09-21-96,82,89.25,226
LastName,FirstName,Team,Position,Birthdate,Height,Wingspan,Weight,College,Year
Fultz,Markelle,76ers,PG,05-29-98,76,81.75,195,Yes,Freshman
Ball,Lonzo,Lakers,PG,10-27-97,78,79,190,Yes,Freshman
Tatum,Jayson,Celtics,SF,03-03-98,80,83,204,Yes,Freshman
Jackson,Josh,Suns,SF,02-10-97,80,81.75,203,Yes,Freshman
Fox,"De'Aaron",Kings,PG,12-20-97,76,78.5,171,Yes,Freshman
Isaac,Jonathan,Magic,SF,10-03-97,83,85.25,205,Yes,Freshman
Markkanen,Lauri,Bulls,PF,05-22-97,84,,225,Yes,Freshman
Ntilikina,Frank,Knicks,PG,07-28-98,77,,170,No,
Smith,Dennis,Mavericks,PG,11-25-97,75,75,195,Yes,Freshman
Collins,Zach,Trail Blazers,C,11-19-97,84,85,230,Yes,Freshman
Monk,Malik,Hornets,SG,02-04-98,76,75.5,197,Yes,Freshman
Kennard,Luke,Pistons,SG,06-25-96,78,77.25,202,Yes,Sophomore
Mitchell,Donovan,Jazz,SG,09-07-96,75,82,210,Yes,Sophomore
Adebayo,Bam,Heat,C,07-18-97,82,86.75,250,Yes,Freshman
Jackson,Justin,Kings,SF,03-28-95,80,83,193,Yes,Junior
Patton,Justin,Timberwolves,C,06-14-97,84,87,226,Yes,Freshman
Wilson,D.J.,Bucks,PF,02-19-96,82,87,240,Yes,Junior
Leaf,T.J.,Pacers,PF,04-30-97,82,83,220,Yes,Freshman
Collins,John,Hawks,PF,09-23-97,82,83.25,225,Yes,Sophomore
Giles,Harry,Kings,C,04-22-98,83,87.25,222,Yes,Freshman
Ferguson,Terrance,Thunder,SG,05-17-98,79,80.75,186,No,
Allen,Jarrett,Nets,C,04-21-98,83,89.25,224,Yes,Freshman
Anunoby,OG,Raptors,PF,07-17-97,80,86.25,215,Yes,Sophomore
Lydon,Tyler,Nuggets,SF,04-09-96,82,84,225,Yes,Sophomore
Pasecniks,Anzejs,76ers,C,12-20-95,86,,229,No,
Swanigan,Caleb,Trail
Blazers,PF,04-18-97,81,87,247,Yes,Sophomore
Kuzma,Kyle,Lakers,PF,07-24-95,81,84.25,221,Yes,Junior
Bradley,Tony,Jazz,C,01-08-98,82,89,248,Yes,Freshman
White,Derrick,Spurs,PG,07-02-94,77,79.5,200,Yes,Senior
Hart,Josh,Lakers,SG,03-06-95,78,80.25,204,Yes,Senior
Jackson,Frank,Pelicans,SG,05-04-98,76,79.5,208,Yes,Freshman
Reed,Davon,Suns,SG,06-11-95,78,84,208,Yes,Senior
Iwundu,Wesley,Magic,SG,12-20-94,79,85,205,Yes,Senior
Mason,Frank,Kings,PG,04-03-94,71,75.25,185,Yes,Senior
Rabb,Ivan,Grizzlies,C,02-04-97,82,85.5,215,Yes,Sophomore
Bolden,Jonah,76ers,PF,01-02-96,82,,227,No,
Ojeleye,Semi,Celtics,SF,12-05-94,79,81.75,235,Yes,Junior
Bell,Jordan,Warriors,PF,01-07-95,81,83.75,227,Yes,Junior
Evans,Juwan,Clippers,PG,07-26-96,73,77.5,177,Yes,Sophomore
Bacon,Dwayne,Hornets,SF,08-30-95,77,82,202,Yes,Sophomore
Dorsey,Tyler,Hawks,SG,02-14-96,76,77.25,180,Yes,Sophomore
Bryant,Thomas,Lakers,C,07-31-97,82,90,241,Yes,Sophomore
Hartenstein,Isaiah,Rockets,PF,05-05-98,84,86.25,225,No,
Dotson,Damyean,Knicks,SG,05-06-94,77,71,202,Yes,Senior
Brooks,Dillon,Grizzlies,SF,01-22-96,79,78,215,Yes,Junior
Brown,Sterling,Bucks,SG,02-10-95,78,81.5,230,Yes,Senior
Anigbogu,Ike,Pacers,C,10-22-98,82,90.25,230,Yes,Freshman
Thornwell,Sindarius,Clippers,SG,11-15-94,77,82,214,Yes,Senior
Cancar,Vlatko,Nuggets,PF,04-10-97,80,83,210,No,
Lessort,Mathias,76ers,PF,09-29-95,81,,250,No,
Morris,Monte,Nuggets,PG,06-27-95,75,76,175,Yes,Senior
Sumner,Edmond,Pacers,PG,12-31-95,77,81,170,Yes,Junior
Allen,Kadeem,Celtics,PG,01-15-93,75,81.25,200,Yes,Senior
Peters,Alec,Suns,PF,04-13-95,81,82.75,225,Yes,Senior
Williams-Goss,Nigel,Jazz,PG,09-16-94,76,79.25,182,Yes,Junior
Bird,Jabari,Celtics,SG,07-03-94,78,80,199,Yes,Senior
Vezenkov,Aleksandar,Nets,SF,08-06-95,81,,225,No,
Jaramaz,Ognjen,Knicks,PG,09-01-95,76,77.5,193,No,
Blossomgame,Jaron,Spurs,SF,09-16-93,79,82,214,Yes,Senior
Kaba,Alpha,Hawks,C,09-21-96,82,89.25,226,No,
Here i am using pare t test because sample size is small. In genaral case the difference between Z-test and t-test: Z- test is used when sample size is large (n>50), or the population variance is known. t-test is used when sample size is small (n<50) and population variance is unknown. Here i create new variables one is first 30 players all have the value of "First" and the second 30 players (observations 31 to 60) have the value of "second" of weight variable and take hypothesis testing for that i have each varible has 30 observation so i used t-test to perform a hypothesis test to determine if the mean weights are different for the first round selections and second round selection.
Below is the R output od the hypothesis testing problem
H0: u1-u2=0
Vs, H1: u1-u2 != 0
`2017NHB` <-
read.csv("C:/Users/Ashwini/Desktop/2017NHB.csv")
> View(`2017NHB`)
> head(`2017NHB`)
LastName FirstName Team Position Birthdate Height Wingspan
Weight
1 Fultz Markelle 76ers PG 05-29-98 76 81.75 195
2 Ball Lonzo Lakers PG 10-27-97 78 79.00 190
3 Tatum Jayson Celtics SF 03-03-1998 80 83.00 204
4 Jackson Josh Suns SF 02-10-1997 80 81.75 203
5 Fox De'Aaron Kings PG 12-20-97 76 78.50 171
6 Isaac Jonathan Magic SF/PF 10-03-1997 83 85.25 205
> D=`2017NHB`
> attach(D)
The following objects are masked from D (pos = 3):
Birthdate, FirstName, Height, LastName, Position, Team,
Weight,
Wingspan
> View(D)
> x=D$Weight
> View(x)
> x1=x[1:30]
> y=x[31:60]
> t.test(x1,y,var.equal = TRUE)
Two Sample t-test
data: x1 and y
t = 0.47687, df = 58, p-value = 0.6352
alternative hypothesis: true difference in means is not equal to
0
95 percent confidence interval:
-8.207221 13.340554
sample estimates:
mean of x mean of y
212.4000 209.8333
Here we can see that P-value is 0.6352 is greater than 0.05 at
5%los so we accept the null hypothesis.
So i conclude that mean weights are same for the first round selections and second round selection.