question archive Subject:Data Science Linear regression Before loading a library, you must confirm if it is installed in your machine

Subject:Data Science Linear regression Before loading a library, you must confirm if it is installed in your machine

Subject:StatisticsPrice: Bought3

Subject:Data Science Linear regression Before loading a library, you must confirm if it is installed in your machine. If not, install it using code - install.packages("Lahman") and then load it using code - library(Lahman)

 

Assessment: Correlation

Question 1

Load the Lahman library. Filter the Teams data frame to include years from 1961 to 2001.

What is the correlation coefficient between number of runs per game and number of at bats per game?

 

Ans: The correlation coefficient can be calculated using the following code:

          library(Lahman)
Teams_small <- Teams %>% filter(yearID %in% 1961:2001)
cor(Teams_small$R/Teams_small$G, Teams_small$AB/Teams_small$G)

 

 

Question2

Use the filtered Teams data frame from Question 1.

What is the correlation coefficient between win rate (number of wins per game) and number of errors per game?

 

Question: 3

Use the filtered Teams data frame from Question 1.

What is the correlation coefficient between doubles (X2B) per game and triples (X3B) per game?

 

Assessment: Baseball as a Motivating Example

 

Load the Lahman library. Filter the Teams data frame to include years from 1961 to 2001. Make a scatterplot of runs per game versus at bats (AB) per game.

Which of the following is true?

There is no clear relationship between runs and at bats per game.

As the number of at bats per game increases, the number of runs per game tends to increase.

As the number of at bats per game increases, the number of runs per game tends to decrease.

 

Question:2

Use the filtered Teams data frame from Question 6. Make a scatterplot of win rate (number of wins per game) versus number of fielding errors (E) per game.

Which of the following is true?

There is no relationship between win rate and errors per game.

As the number of errors per game increases, the win rate tends to increase.

As the number of errors per game increases, the win rate tends to decrease.

 

Question:3

Use the filtered Teams data frame from Question 6. Make a scatterplot of triples (X3B) per game versus doubles (X2B) per game.

Which of the following is true?

There is no clear relationship between doubles per game and triples per game.

As the number of doubles per game increases, the number of triples per game tends to increase.

As the number of doubles per game increases, the number of triples per game tends to decrease.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE