This analysis uses the Dodgers dataset, which tracks attendance at Los Angeles Dodgers home games along with details like the day of the week, opponent, temperature, weather, and promotions (caps, shirts, fireworks, and bobbleheads). It’s useful from a marketing lens because it shows what may drive fans to show up.
library(readr)
library(dplyr)
library(ggplot2)
data <- read_csv("DodgersData.csv")
original_n <- nrow(data)
set.seed(123)
sample_data <- data %>% sample_frac(0.5)
sample_n <- nrow(sample_data)
original_n
## [1] 81
sample_n
## [1] 40
The original dataset contains 81 observations. For this analysis, a
random sample of about half the data was drawn (using
sample_frac(0.5) with a fixed seed for reproducibility),
resulting in 40 observations used in the analysis.
summary(sample_data$attend)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 24312 33966 39986 41187 49006 55279
ggplot(sample_data, aes(x = attend)) +
geom_histogram(binwidth = 5000, fill = "steelblue", color = "white") +
ggtitle("Distribution of Dodgers Game Attendance") +
xlab("Attendance") +
ylab("Number of Games")
The summary statistics and histogram show how attendance is spread across games, including the typical crowd size (mean and median) and the range from the lowest to highest attended games.
ggplot(sample_data, aes(x = bobblehead, y = attend, fill = bobblehead)) +
geom_boxplot() +
ggtitle("Attendance With and Without a Bobblehead Promotion") +
xlab("Bobblehead Promotion") +
ylab("Attendance") +
theme(legend.position = "none")
sample_data %>%
group_by(bobblehead) %>%
summarise(games = n(),
mean_attendance = mean(attend),
median_attendance = median(attend))
## # A tibble: 2 × 4
## bobblehead games mean_attendance median_attendance
## <chr> <int> <dbl> <dbl>
## 1 NO 35 39306. 38016
## 2 YES 5 54354 54621
The boxplot and table compare attendance on games with and without a bobblehead giveaway, which shows whether this promotion is linked to bigger crowds.
Attendance varies quite a bit from game to game, with most games landing around the middle of the range and a few very high turnouts. Games with a bobblehead promotion tend to draw noticeably bigger crowds than games without one. This suggests that giveaways like bobbleheads can be an effective marketing tool for boosting attendance.