Question: * * THE PROGRAMMING LANGUAGE IS IN R , RSTUDIOS, and JUPYTER. Please don't use pandas or Python. 7 . 8 LAB: Creating simple linear

**THE PROGRAMMING LANGUAGE IS IN R,RSTUDIOS, and JUPYTER. Please don't use pandas or Python.
7.8 LAB: Creating simple linear regression models
The nbaallelo_slr dataset contains information on 126315 NBA games between 1947 and 2015. The columns report the points made
by one team, the Elo rating of that team coming into the game, the Elo rating of the team after the game, and the points made by the
opposing team. The Elo score measures the relative skill of teams in a league.
Load the dataset into a data frame.
Create a new column y in the data frame that is the difference between the points made by the two teams.
Use the lm () function to perform a simple linear regression using y as the output feature and elo_i as the input feature.
Print the intercept and slope of the linear regression model.
Compute the proportion of variation explained by the linear regression.
Ex: If the Elo rating of the team after the game, elo_n, is used instead of elo_i, the output is:
[1] "The intercept of the linear regression line is -59.135."
[1] "The slope of the linear regression line is 0.04."
[1] "The proportion of variation explained by the linear regression model is 0.111."
587778.2727428.9 xx3zq9y7
*****************Start of code*********************
Read in nbaallelo_slr.csv
nba - # Your code here
Create a new column in the data frame that is the difference between pts and opp_pts
nba$y - # Your code here
Fit a least squares regression model on y and elo_i
SLRModel - # Your code here
Print the intercept
intercept - # Your code here
print(paste0("The intercept of the linear regression line is ", format(round(intercept,3)),"."))
Print the slope
slope - # Your code here
print(paste0("The slope of the linear regression line is ", format(round(slope,3)),"."))
Compute the proportion of variation explained by the linear regression
rSquare - # Your code here
print(paste0("The proportion of variation explained by the linear regression model is ", format(round(rSquare,3)),"
* * THE PROGRAMMING LANGUAGE IS IN R , RSTUDIOS,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!