DodgersData <- read.csv("DodgersData (1).csv")
DodgersData[25, c("temp", "attend", "opponent", "bobblehead")]
## temp attend opponent bobblehead
## 25 61 36561 Astros NO
The 25th home game had a temperature of 61 degrees, attendance of 36,561 people, and the opponent was the Astros. There was no bobblehead promotion.
median(DodgersData$attend)
## [1] 40284
The median attendance was 40,284 people.
sum(DodgersData$day_night == "Night")
## [1] 66
The Dodgers had 66 night games.
library(ggplot2)
ggplot(DodgersData, aes(x = temp, y = attend)) +
geom_point(color = "dodgerblue", size = 2) +
labs(
title = "Dodgers Attendance by Temperature",
x = "Temperature",
y = "Attendance"
) +
theme_minimal()
The scatter plot shows that temperature had only a weak relationship with attendance. Attendance varied widely at different temperatures, suggesting that promotions and other factors were more important.
DodgersData$month <- factor(DodgersData$month)
DodgersData$day_of_week <- factor(DodgersData$day_of_week)
model <- lm(
attend ~ month + day_of_week + bobblehead,
data = DodgersData
)
summary(model)
##
## Call:
## lm(formula = attend ~ month + day_of_week + bobblehead, data = DodgersData)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10786.5 -3628.1 -516.1 2230.2 14351.0
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 38792.98 2364.68 16.405 < 2e-16 ***
## monthAUG 2377.92 2402.91 0.990 0.3259
## monthJUL 2849.83 2578.60 1.105 0.2730
## monthJUN 7163.23 2732.72 2.621 0.0108 *
## monthMAY -2385.62 2291.22 -1.041 0.3015
## monthOCT -662.67 4046.45 -0.164 0.8704
## monthSEP 29.03 2521.25 0.012 0.9908
## day_of_weekMonday -4883.82 2504.65 -1.950 0.0554 .
## day_of_weekSaturday 1488.24 2442.68 0.609 0.5444
## day_of_weekSunday 1840.18 2426.79 0.758 0.4509
## day_of_weekThursday -4108.45 3381.22 -1.215 0.2286
## day_of_weekTuesday 3027.68 2686.43 1.127 0.2638
## day_of_weekWednesday -2423.80 2485.46 -0.975 0.3330
## bobbleheadYES 10714.90 2419.52 4.429 3.59e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6120 on 67 degrees of freedom
## Multiple R-squared: 0.5444, Adjusted R-squared: 0.456
## F-statistic: 6.158 on 13 and 67 DF, p-value: 2.083e-07
The results showed that bobblehead promotions had a strong effect on attendance. Games with a bobblehead giveaway had about 10,715 more fans than games without one. The results also showed that the month, day of the week, and promotions helped explain why attendance was different from game to game.
At first, I thought attendance would mostly depend on the temperature because fans might prefer going to games when the weather is warmer. However, after looking at the results, I think promotions, especially bobblehead giveaways, had a bigger effect on attendance than temperature.
My question is: Would attendance have been even higher if the Dodgers had offered more promotions during the season?
Dodgers games with a bobblehead promotion will have higher attendance than games without a bobblehead promotion.
Dodgers games played on weekends will have higher attendance than games played on weekdays.