Question
This assessment has 6 multi-part questions that will all use the setup below. Game attendance in baseball varies partly as a function of how well
This assessment has 6 multi-part questions that will all use the setup below.
Game attendance in baseball varies partly as a function of how well a team is playing.
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.
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:1
How many observations are in the 8 win strata?
(Note that due to division and rounding, these teams have 75-85 wins.)
Question:2
Fit a multivariate regression determining the effects of runs per game, home runs per game, wins, and year on average attendance. Use the originalTeams_smallwins column, not the win strata from question 1.
What is the estimate of the effect of runs per game on average attendance?
What is the estimate of the effect of home runs per game on average attendance?
What is the estimate of the effect of number of wins in a season on average attendance?
Question:3
Use the multivariate regression model from Question 2. Suppose a team averaged 5 runs per game, 1.2 home runs per game, and won 80 games in a season.
What would this team's average attendance be in 2002?
What would this team's average attendance be in 1960?
Question:4
Use your model from Question 2 to predict average attendance for teams in 2002 in the originalTeamsdata frame.
What is the correlation between the predicted attendance and actual attendance?
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