Question
Load the Lahman library. The Teams data frame contains an attendance column. This is the total attendance for the season. To calculate average attendance, divide
Load theLahmanlibrary. TheTeamsdata frame contains anattendancecolumn. This is the total attendance for the season. To calculate average attendance, divide by the number of games played, as follows:
library(tidyverse)
library(broom)
library(Lahman)
Teams_small <- Teams %>%
filter(yearID %in% 1961:2001) %>%
mutate(avg_attendance = attendance/G)
Use linear models to answer the following 3-part question aboutTeams_small.
Question 1a
0.0/2.0 points (graded)
Use runs (R) per game to predict average attendance.
For every 1 run scored per game, attendance increases by how much?
unanswered
Use home runs (HR) per game to predict average attendance.
For every 1 home run hit per game, attendance increases by how much?
unanswered
Submit
You have used 0 of 10 attempts
Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Save
Save Your Answer
Question 1b
0.0/2.0 points (graded)
Use number of wins to predict attendance; do not normalize for number of games.
For every game won in a season, how much does average attendance increase?
unanswered
Suppose a team won zero games in a season.
Predict the average attendance.
unanswered
Submit
You have used 0 of 10 attempts
Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Save
Save Your Answer
Question 1c
0.0/1.0 point (graded)
Use year to predict average attendance.
How much does average attendance increase each year?
unanswered
Submit
You have used 0 of 10 attempts
Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Save
Save Your Answer
Question 2
0.0/2.0 points (graded)
Game wins, runs per game and home runs per game are positively correlated with attendance. We saw in the course material that runs per game and home runs per game are correlated with each other. Are wins and runs per game or wins and home runs per game correlated?
What is the correlation coefficient for wins and runs per game?
unanswered
What is the correlation coefficient for wins and home runs per game?
unanswered
Submit
You have used 0 of 10 attempts
Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Save
Save Your Answer
StratifyTeams_smallby wins: divide number of wins by 10 and then round to the nearest integer. Keep only strata 5 through 10, which have 20 or more data points.
Use the stratified dataset to answer this three-part question.
Question 3a
0.0/1.0 point (graded)
How many observations are in the 8 win strata?
(Note that due to division and rounding, these teams have 75-84 wins.)
unanswered
Submit
You have used 0 of 10 attempts
Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.
Save
Save Your Answer
Question 3b
0.0/2.0 points (graded)
Calculate the slope of the regression line predicting average attendance given runs per game for each of the win strata.
Which win stratum has the largest regression line slope?
5
6
7
8
9
10
unanswered
Calculate the slope of the regression line predicting average attendance given HR per game for each of the win strata.
Which win stratum has the largest regression line slope?
5
6
7
8
9
10
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started