Case Study for Google Analytics Certification by Coursera


This is my case study for completion of Google Data Analytics Certification.


     The purpose of this case study is to answer the question ” On the PGA Tour do the top 10 Players with the longest drives in the game have better Greens in Regulation, fewer putts, Scores and Money Earned as a result of the longer drives, as compared to the Average of all PGA Tour players?”

Index / Flow of data


       This will be explored by comparing the top 10 Drivers to the Average of All Pga Drives as well as the GIR, Putting, Scoring and Money Earned through visualizations.

       Then we will look at the Average Distances of the Top 10 Drivers and the Average of all PGA Players vs Each metric, through visualizations.

       The next step will be to look at the correlations of the Average Drives of the top 10 Drivers and all PGA Players Drives,and see if there are observable relations over the full 13 years. This through correlation charts.

       Finally we will combine all the relevant data for the full time period and compare the correlations through visualizations and draw final Conclusions and Suggest possible action for Golfers as a result of the data presented.

Install Packages and Libraries needed to complete case study

install.packages("tidyverse") 
install.packages("readr")  
install.packages("formattable")
install.packages("gridExtra") 
install.packages("ggpubr") 
install.packages("Hmisc") 
install.packages("corrplot") 
install.packages("PerformanceAnalytics") 

library(PerformanceAnalytics) 
library(Hmisc) 
library(corrplot) 
library(ggpubr)
library(tidyverse) 
library(dplyr) 
library(readr) 
library(ggplot2) 
library(tidyr) 
library(janitor) 
library(rmarkdown) 
library(lubridate) 
library(scales) 
library(formattable) 
library(gridExtra)

Data retrieval, cleaning and filtering



       Csv Files were created by retrieving data from PGA.com and ESPN.com to Excel. The data was then Cleaned and organized to allow for continued analysis through working with R.


        Excel cleaning included cleaning out data columns not required, aggregating by Year, sorting by top 10 Drivers by Year and all PGA players by year. Cross referencing data filtered and cleaned to original data for integrity.


       As far as a review of bias in my data, I acknowledge that i am using only PGA data from U.S. sources and have not included data from all countries Professional players play in, nor does it include Amateur Professional data or Senior professional data. I have also not used and Female Professional data in my analysis.

Load csv data files.

# upload edited and cleaned csv files from excel 

pga_data<-read_csv("espn_pga_data_csv.csv") 
t10_pga_data<-read_csv("espn_pga_data_t10_csv.csv") 

Average Drive Comparison of the top 10 Pga Drivers as compared to all Pga players, inclusive of the top 10.



Average drive distance for PGA players by year.

# all player average drive distance df

distance_df<- pga_data %>% 
  select(avg_drive, date) %>% 
  group_by(Year = date) %>% 
  summarise (Average_Drive_Yards = mean (avg_drive,2)) 
Average drive distance for top 10 PGA players by year.

# top 10 average drive distance df

t10_distance_df<- t10_pga_data %>%
  select(avg_drive, date) %>%
  group_by(Year = date) %>% 
  summarise (Average_Drive_Yards_t10 = mean (avg_drive,2)) 

Average Drive Distance Comparison


Data Frames modification for date
distance_df$Year <- paste0(" ", distance_df$Year) 
t10_distance_df$Year <- paste0(" ", t10_distance_df$Year) 
Merge data Frames
merged_distance<-merge(distance_df, t10_distance_df)
Plot and customize Combined Data Frames for Drive distance Comparison.
## plot of average distance of top 10 drivers and all player average drive

ggplot(data = merged_distance)+ 
  geom_point(mapping = aes(x = Year, y = Average_Drive_Yards), color = 'blue')+
  geom_text(size = 2.5, mapping =aes(x = Year, y = Average_Drive_Yards,label = paste0(" ",Average_Drive_Yards," ")),nudge_y = +3.0)+ 
  geom_point(mapping = aes(x = Year, y = Average_Drive_Yards_t10), color = 'red')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = Average_Drive_Yards_t10,label = paste0("T10 ", Average_Drive_Yards_t10," ")),nudge_y = +3.0)+ 
  ylim(280,325)+ 
  labs(title ="Average Drive Distance by Year (Yards)", subtitle ="PGA Players Avg VS PGA top 10 Drivers Avg", caption = "Data courtesy PGA Tour.com and espn.com")+ 
  scale_x_discrete(guide = guide_axis(n.dodge = 2))+ 
  theme_light()


Clean environment
remove(distance_df, t10_distance_df) 



Average Greens in Regulation percent Comparison of the top 10 Pga Drivers as compared to all Pga players, inclusive of the top 10.


Average GIR for PGA Players by Year
# all player average greens in regulation df

gir_df<- pga_data %>% 
  select(gir, date) %>% 
  group_by(Year = date) %>% 
  summarise (gir = mean (gir,2)) 
Average GIR for top 10 PGA players by year
# top 10 greens in regulation df

t10_gir_df<- t10_pga_data %>% 
  select(gir, date) %>% 
  group_by(Year = date) %>% 
  summarise (t10_gir = mean (gir,2)) 
Data Frames modify for Date
gir_df$Year <- paste0(" ", gir_df$Year) 
t10_gir_df$Year <- paste0(" ", t10_gir_df$Year) 
Merge data Frames
merged_gir<-merge(gir_df, t10_gir_df)
merged_gir$gir<-formattable(merged_gir$gir,format="f",digits=1)
merged_gir$t10_gir<- formattable(merged_gir$t10_gir, format = "f", digits =1)
Plot and customize Combined Data Frames for Greens in Regulation Comparison.
# plot of average greens in regulation of top 10 drivers and all player average greens in regulation

ggplot(data = merged_gir)+ 
  geom_point(mapping = aes(x = Year, y = gir), color = 'blue')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = gir,label = paste0(" ", gir," ")),nudge_y = -2.0)+         geom_point(mapping = aes(x = Year, y = t10_gir), color = 'red')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = t10_gir,label = paste0("T10 ", t10_gir," ")),nudge_y =     +2.0)+ 
  ylim(50,75)+ 
  labs(title ="Greens in Regulation by Year (%)",subtitle ="PGA Players Avg VS PGA top 10 GIR Avg", caption     ="Data courtesy PGA Tour.com and espn.com")+ 
  scale_x_discrete(guide = guide_axis(n.dodge = 2))+ 
  theme_light() 


Clean environment
remove(t10_gir_df, gir_df)



Average Number of putts Comparison of the top 10 Pga Drivers as compared to all Pga players, inclusive of the top 10.


Average Number of Putts for all PGA Players by Year

# all player average putts df

putts<- pga_data %>% 
  select(avg_putts, date) %>% 
  group_by(Year = date) %>% 
  reframe(putts = mean(avg_putts))

Average Number of putts for top 10 PGA players by year.

# top 10 average putts df

t10_putts<- t10_pga_data %>% 
  select(avg_putts, date) %>% 
  group_by(Year = date) %>% 
  summarise (t10_putts = mean (avg_putts)) 
Data Frames modify for date
putts$Year <- paste0(" ", putts$Year)
t10_putts$Year <- paste0(" ", t10_putts$Year)
Merge data Frames
merged_putts<-merge(putts, t10_putts)
merged_putts$putts<-formattable(merged_putts$putts,format="f",digits=2) 
merged_putts$t10_putts<- formattable(merged_putts$t10_putts, format = "f", digits =2) 
Plot and customize Combined Data Frames for putting comparison.
# plot of average putts per hole of top 10 drivers and all player average player

ggplot(data = merged_putts)+ 
  geom_point(mapping = aes(x = Year, y = putts), color = 'blue')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = putts,label = paste0(" ", putts," ")),nudge_y = -0.03)+    geom_point(mapping = aes(x = Year, y = t10_putts), color = 'red')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = t10_putts,label = paste0("T10 ", t10_putts," ")),nudge_y     =+0.03)+ 
  ylim(1.7,1.85)+ 
  labs(title ="Average Number of Putts by Year (%)",subtitle ="PGA Players Avg VS PGA top 10 Number of        Putts",     caption = "Data courtesy PGA Tour.com and espn.com")+ scale_x_discrete(guide = guide_axis(n.dodge =   2))+         
  theme_light()

Clean environment
remove(putts, t10_putts)



Average Score Comparison of the top 10 Pga Drivers as compared to all Pga players, inclusive of the top 10.


Average Score for PGA Players by Year
# all player average score df

allscore<- pga_data %>% 
  select(avg_score, date) %>% 
  group_by(Year = date) %>% 
  summarise (score = mean (avg_score,2))
Average score for top 10 PGA players by year.
# top 10 score df

t10_score<- t10_pga_data %>% 
  select(avg_score, date) %>% 
  group_by(Year = date) %>% 
  summarise (t10_score = mean (avg_score,2))
Data Frames modify for date
allscore$Year <- paste0(" ", allscore$Year) 
t10_score$Year <- paste0(" ", t10_score$Year)
Merge Data Frames
merged_score<-merge(allscore, t10_score)
merged_score$score<-formattable(merged_score$score,format="f",digits=1) 
merged_score$t10_score<- formattable(merged_score$t10_score, format = "f", digits =1)
Plot and Customize Combined Data Frames for Scoring Comparison
# plot of average score of top 10 drivers and all player average score

ggplot(data = merged_score)+ 
  geom_point(mapping = aes(x = Year, y = score), color = 'blue')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = score,label = paste0(" ", score," ")),nudge_y = -0.7)+       geom_point(mapping = aes(x = Year, y = t10_score), color = 'red')+ 
  geom_text(size = 2.5, mapping =aes(x = Year, y = t10_score,label = paste0("T10 ", t10_score," ")),nudge_y     = 0.7)+ 
  ylim(69,72)+ 
  labs(title ="Average Score by Year",subtitle = "PGA Players Avg VS PGA top 10 Score", caption = "Data courtesy PGA Tour.com and espn.com")+ 
  scale_x_discrete(guide = guide_axis(n.dodge = 2))+ 
  theme_light()

Clean environment
remove(allscore, t10_score)



Average Tour money earned Comparison of the top 10 Pga Drivers as compared to all Pga players, inclusive of the top 10.


Average Winnings for PGA Players by Year ($)
# pga official winnings data edit

pga_data<- pga_data %>% 
  mutate_if(~any(str_detect(., '^\\$'), na.rm = FALSE), ~as.numeric(str_replace_all(., '[$,]', '')))
# pga official winnings df

money<- pga_data %>% 
  select(official_winnings, date) %>% 
  group_by(Year = date) %>% 
  summarise (official_winnings = round(mean(official_winnings/1000000),5))
Average Winning for top 10 PGA players by year ($)
# t10 data edit

t10_pga_data<-t10_pga_data %>% 
  mutate_if(~any(str_detect(., '^\\$'), na.rm = FALSE), ~as.numeric(str_replace_all(., '[$,]', '')))
# top 10 official winnings df

t10_money<- t10_pga_data %>% 
  select(official_winnings, date) %>% 
  group_by(Year = date) %>% 
  summarise (official_winnings_t10 = round(mean(official_winnings/1000000),5))
Data Frames Modify for date
money$Year <- paste0(" ", money$Year) 
t10_money$Year <- paste0(" ", t10_money$Year)
Merge data Frames for PGA tour Money earned by year.
merged_money<-merge(money, t10_money)
merged_money$official_winnings<-formattable(merged_money$official_winnings,format="f",digits=2)
merged_money$official_winnings_t10<-formattable(merged_money$official_winnings_t10,format="f",digits=2)
Plot and customize Combined Data Frames
# plot of average earnings of top 10 drivers and all player average drive

ggplot(data = merged_money)+ 
  geom_point(mapping = aes(x = Year, y = official_winnings), color = 'blue')+      
  geom_text(size = 2.5, check_overlap = TRUE, mapping = aes(x = Year, y = official_winnings,label = paste0(" ",
  official_winnings," ")), nudge_y = -.4)+ 
  geom_point(mapping = aes(x = Year, y = official_winnings_t10), color = 'red')+ 
  geom_text(size = 2.5, check_overlap = TRUE, mapping = aes(x = Year, y = official_winnings_t10,label = 
  paste0("T10 $ ", official_winnings_t10,"")),nudge_y = .4)+ 
  labs(title ="Average Winnings by Year", subtitle = "PGA Players Avg VS PGA top 10 Avg Winnings (Millions     $)",
  caption = "Data courtesy PGA Tour.com and espn.com")+ 
  ylab("Average Total Winnings")+ 
  ylim(0,4.5)+           
  scale_x_discrete(guide = guide_axis(n.dodge = 2))+ 
  theme_light()

Clean environment
remove(money, t10_money)



Distance / GIR comparison plots.

# df for average Greens in Regulation vs average distance

dvsg<- cbind(merged_distance,merged_gir) 
dvsg_df<- right_join(merged_distance, merged_gir, by = join_by(Year))
dvsg_df$Year <- ymd(dvsg_df$Year) 
Clean Environment
remove(dvsg)


| | ##### Set plots for Drive/ Greens in Regulation comparison and plot together.

# upper plot for average distance

p1<-ggplot(dvsg_df) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards, color = "Average_Drive_Yards")) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards_t10, color = "Average_Drive_Yards_t10"))+                   scale_color_manual(name = 'Avg Drive', breaks = c('Average_Drive_Yards', 'Average_Drive_Yards_t10'), values     = c('blue', 'red'))+ 
  labs(title = "Average Drive Distance (Yards)", subtitle = "PGA Players Avg VS PGA top 10 Avg Drive")+        ylab("Yards")+ 
  ylim(285,325)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
# lower plot for average Greens in Regulation

p2<-ggplot(dvsg_df)+ 
  geom_point(aes(x = Year, y = gir, color = "gir"))+ 
  geom_point(aes(x = Year, y = t10_gir, color = "t10_gir"))+ scale_color_manual(name='GIR', breaks=c('gir',     't10_gir'), values=c('blue', 'red'))+ 
  labs(title = "Average Greens in Regulation by Year", subtitle = "PGA Players Avg VS PGA top 10 Avg GIR ( %     )", caption = "Data courtesy PGA Tour.com and espn.com")+ 
  ylab("GIR %")+ ylim(55,70)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
grid.arrange(p1,p2, nrow = 2)


As we look at the visualization we can see that the top 10 PGA Drivers do in fact have a better GIR as compared to the All Pga player average consistently.

remove(p1,p2,dvsg_df)


Distance / Putts comparison plots.

# df for average putts vs average drive

dvsp<- cbind(merged_distance,merged_putts)

dvsp_df<- right_join(merged_distance, merged_putts, by = join_by(Year))

dvsp_df$Year <- ymd(dvsp_df$Year) 
Clean Environment
remove(dvsp)



Set plots for Drive/ Score in Regulation comparison and plot together
# upper plot of average distance

p3<-ggplot(dvsp_df) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards, color = "Average_Drive_Yards")) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards_t10, color = "Average_Drive_Yards_t10"))+
  scale_color_manual(name = 'Avg Drive', breaks = c('Average_Drive_Yards', 'Average_Drive_Yards_t10'),
  values= c('blue', 'red'))+ 
  labs(title = "Average Drive Distance (Yards)", subtitle = "PGA Players Avg VS PGA top 10 Avg Drive")+
  ylab("Yards")+ 
  ylim(285,325)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
# lower plot of average putts

p4<-ggplot(dvsp_df)+ 
  geom_point(aes(x = Year, y = putts, color = "putts"))+ 
  geom_point(aes(x = Year, y = t10_putts, color = "t10_putts"))+ 
  scale_color_manual(name='Putts',  breaks=c('putts', 't10_putts'), values=c('blue', 'red'))+ 
  labs(title = "Average putts by Year", subtitle = "PGA Players Avg VS PGA top 10 Avg putts ( # )", caption =   "Data courtesy PGA Tour.com and espn.com")+ 
  ylab("Putts #")+ 
  ylim(1.75,1.85)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
grid.arrange(p3,p4, nrow = 2)


As we look at this visualization we can see that the number of putts is lower with a longer drive in 7 of 13 years and almost identical in 3 others.
remove(p3,p4,dvsp_df)


Distance / Score comparison plots.

# df for average drive and score plot

dvss<- cbind(merged_distance,merged_score)

dvss_df<- right_join(merged_distance, merged_score, by = join_by(Year))

dvss_df$Year <- ymd(dvss_df$Year) 

class(dvss_df$Year) 
## [1] "Date"
Clean Environment
remove(dvss)


Set plots for Drive/ Score in Regulation comparison and plot together
# upper plot of Average distance

p5<-ggplot(dvss_df) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards, color = "Average_Drive_Yards")) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards_t10, color = "Average_Drive_Yards_t10"))+     scale_color_manual(name = 'Avg Drive', breaks = c('Average_Drive_Yards', 'Average_Drive_Yards_t10'), values =     c('blue', 'red'))+ 
  labs(title = "Average Drive Distance (Yards)", subtitle = "PGA Players Avg VS PGA top 10 Avg Drive")+        ylab("Yards")+ 
  ylim(285,325)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
# Lower plot of average score

p6<-ggplot(dvss_df)+ 
  geom_point(aes(x = Year, y = score, color = "score"))+ 
  geom_point(aes(x = Year, y = t10_score, color = "t10_score"))+ 
  scale_color_manual(name = 'score',  breaks = c('score', 't10_score'), values=c('blue', 'red'))+ 
  labs(title = "Average score by Year", subtitle = "PGA Players Avg VS PGA top 10 Avg score", caption = "Data courtesy PGA Tour.com and espn.com")+ 
  ylab("Score")+ 
  ylim(69,72)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))

grid.arrange(p5,p6, nrow = 2)


With this visualization we can see a lower avg score in 8 of 13 years and almost identical avg score in 3 other years.
remove(p5,p6,dvss_df)

Distance money comparison plots.

# df for Official winnings or Money  and Drive Distance

dvsm<- cbind(merged_distance,merged_money)

dvsm_df<- right_join(merged_distance, merged_money, by = join_by(Year))

dvsm_df$Year <- ymd(dvsm_df$Year) 
Clean environment
remove(dvsm)


Set plots for Drive/ Money comparison and plot together

# Upper plot of Average Drives

p7<-ggplot(dvsm_df) + 
  geom_point(aes(x = Year, y = Average_Drive_Yards), color = "blue") + 
  geom_point(aes(x = Year, y = Average_Drive_Yards_t10), color = "red")+ labs(title = "Average Drive distance   (Yards)", subtitle = "PGA Players Avg VS PGA top 10 Avg Drive")+ 
  ylab("Yards")+
  ylim(285,325)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))
# Lower plot of Official winnings

p8<-ggplot(dvsm_df)+ 
  geom_point(aes(x = Year, y = official_winnings), color = "blue")+ 
  geom_point(aes(x = Year, y = official_winnings_t10), color = "red")+ 
  labs(title = "Average Winnings by Year", subtitle = "PGA Players Avg VS PGA top 10 Avg Winnings (Millions $)", caption = "Data courtesy PGA Tour.com and espn.com")+ 
  ylab("Millions $")+
  ylim(.8,4.3)+ 
  theme(plot.background = element_rect(fill = 'lightgreen'))

grid.arrange(p7,p8, nrow = 2)


Here we can see there is a noticeable difference when we compare Drive distance to average PGA Tour earnings. Longer drivers make more money.

remove(p7,p8,dvsm_df)

Correlation examination of top 10 Drivers and all PGA Players, inclusive of the top 10 by metric.


Visualization of Drive distance over Greens in Regulation by year.

# Distance vs Greens in Regulation df

dvgir<- merge(merged_distance, merged_gir)

dvgir$gir<- formattable(dvgir$gir, format = "f", digits = 1) 

dvgir$t10_gir<- formattable(dvgir$t10_gir, format = "f", digits = 1)

dvgir$Year <- ymd(dvgir$Year)

dvgir$Year <- as.Date(dvgir$Year)

dvgir <- as.xts(dvgir [, -1], order.by = dvgir$Year)
# Distance vs Greens in Regulation Plot

gircor <- cor(dvgir, method = "spearman") # pearson was also run with virtually the same results

corrplot(gircor, type = "lower", tl.srt = 5, addCoef.col = "white", cex.main = .8)
dvgir<- title("Drive Distance vs GIR", cex.main = 1)


As we look ath this image we can see measure of 0.70 for the Average Drive vs 0.29 for the top 10 drivers. To me this says that for the average driver the is a much larger correlation to drive length, thus you would need to hit longer for a better gir percentage.

Clean environment
remove(dvgir, gircor)



Visualization of drive distance over number of putts.

# Distance vs Putts df

dvsp<- merge(merged_distance, merged_putts)

dvsp$putts<- formattable(dvsp$putts, format = "f", digits = 1) 

dvsp$t10_putts<- formattable(dvsp$t10_putts, format = "f", digits = 1)

dvsp$Year <- ymd(dvsp$Year)

dvsp$Year <- as.Date(dvsp$Year)

dvsp <- as.xts(dvsp [, -1], order.by = dvsp$Year)
# Distance vs Putts plot

puttcor <- cor(dvsp, method = "spearman") # pearson was also run with virtually the same results

corrplot(puttcor, type = "lower", tl.srt = 5, addCoef.col = "white", cex.main = .8)
dvsp<-title("Drive distance vs Putts", cex.main = 1)

Here we find that the correlation of drive length to putts for the top 10 drivers is -0.46 as compared to the average of all players at -0.85. From this i see that there is almost no relation to drive length for the averge player, however there is a stronger relation for the top 10. The meaning we can infer that here is a longer drive should, as previously said, provide a better GIR, then result in fewer putts.

Clean environment
remove(dvsp, puttcor)


Visualization of drive distance over Average Score
# Distance vs Score df

dvss<- merge(merged_distance, merged_score)

dvss$score<- formattable(dvss$score, format = "f", digits = 1) 

dvss$t10_score<- formattable(dvss$t10_score, format = "f", digits = 1)

dvss$Year <- ymd(dvss$Year)

dvss$Year <- as.Date(dvss$Year)

dvss <- as.xts(dvss [, -1], order.by = dvss$Year)
# Distance vs Score plot

scorcor <- cor(dvss, method = "spearman") # pearson was also run with virtually the same results

corrplot(scorcor, type = "lower", tl.srt = 5, addCoef.col = "white", cex.main = .8)
dvss<-title (" Drive Distance vs Score", cex.main = 1)

We have seen that the longest drivers have a better chance at gir and fewer putts. Similar to the last image we see very little relation of drive length to score at 0.70 but a comparatively stroner relation to the top 10 drivers at 0.44. Here again we see a longer drive may relate to a lowers score.

######Clean environment

remove(dvss, scorcor)


Visualization of drive distance over PGA tour earnings.

# Distance vs Earnings df

dvsmo<- merge(merged_distance, merged_money)

dvsmo$official_winnings<- formattable(dvsmo$official_winnings, format = "f", digits = 1)

dvsmo$official_winnings_t10<- formattable(dvsmo$official_winnings_t10, format = "f", digits = 1)

dvsmo$Year <- ymd(dvsmo$Year)

dvsmo$Year <- as.Date(dvsmo$Year)

dvsmo <- as.xts(dvsmo [, -1], order.by = dvsmo$Year)
# Distance vs Earnings data plot

moncor <- cor(dvsmo, method = "spearman") # pearson was also run with virtually the same results

corrplot(moncor, type = "lower", tl.srt = 5, addCoef.col = "white", cex.main = .8)
dvsmo<-title("Drive Distance vs Earnings", cex.main = 1)

Visual look at correlations, using the “spearman” method for all PGA Players, inclusive of the top 10 drivers.


# All PGA correlation plot and df

allpga<- pga_data %>% 
  select(avg_drive, gir, avg_putts, avg_score, official_winnings,date) %>%
  group_by(Year = date)

allpga<-allpga[,-6]

allpga$gir<- formattable(allpga$gir, format = "f", digits = 1) 
allpga$avg_putts<- formattable(allpga$avg_putts, format = "f", digits = 1) 
allpga$avg_score<- formattable(allpga$avg_score, format = "f", digits = 1) 
allpga$official_winnings<- formattable(allpga$official_winnings, format = "f", digits = 2) 
allpga$avg_drive<- formattable(allpga$avg_drive, format = "f", digits = 1)

allpga$Year <- ymd(allpga$Year)

allpga$Year <- as.Date(allpga$Year)

allpga <- as.xts(allpga [, -6], order.by = allpga$Year)

allcor <- cor(allpga, method = "spearman") # pearson was also run with virtually the same results

corrplot(allcor, type = "lower", tl.srt = 5, addCoef.col = "black")

allpga<- title (
     "Correlations,
         All Player Averages from 2010 to 2022", cex.main = 1)

Visual look at correlations, using the “spearman” method for top 10 PGA drivers.

# Top 10 correlation plot and df

t10pga<- t10_pga_data %>% 
  select(avg_drive, gir, avg_putts, avg_score, official_winnings,date) %>% 
  group_by(Year = date)

t10pga<-t10pga[,-6]

t10pga$gir<- formattable(t10pga$gir, format = "f", digits = 1) 
t10pga$avg_putts<- formattable(t10pga$avg_putts, format = "f", digits = 1) 
t10pga$avg_score<- formattable(t10pga$avg_score, format = "f", digits = 1) 
t10pga$official_winnings<- formattable(t10pga$official_winnings, format = "f", digits = 2) 
t10pga$avg_drive<- formattable(t10pga$avg_drive, format = "f", digits = 1)

t10pga$Year <- ymd(t10pga$Year)

t10pga$Year <- as.Date(t10pga$Year)

t10pga <- as.xts(t10pga [, -6], order.by = t10pga$Year)

t10cor <- cor(t10pga, method = "spearman") # pearson was also run with virtually the same results

corrplot(t10cor, type = "lower", tl.srt = 5, addCoef.col = "black")

t10pga<- title(
    "Correlations, 
            Top 10 Player Averages from 2010 to 2022", cex.main = 1)




A combined look at all PGA players, inclusive of the top 10 drivers and the top 10 drivers using the

“spearman” method with average drive vs all metrics.

# Final data frames for plotting

t10pga<- t10_pga_data %>% 
  select(t10drive = avg_drive, t10gir = gir, t10putts = avg_putts, t10score = avg_score, t10money = official_winnings,date) %>% 
  group_by(Year = date)

t10pga<- t10pga[, -6]

t10pga$Year <- ymd(t10pga$Year)

allpga<- pga_data %>% 
  select(avg_drive, gir, avg_putts, avg_score, official_winnings,date) %>% 
  group_by(Year = date)

allpga<- allpga[,-6]

allpga$Year <- ymd(allpga$Year)
# Final plot to discuss an solidify findings with correlations

t10pga$t10gir<- formattable(t10pga$t10gir, format = "f", digits = 1) 
t10pga$t10putts<- formattable(t10pga$t10putts, format = "f", digits = 1) 
t10pga$t10score<- formattable(t10pga$t10score, format = "f", digits = 1) 
t10pga$t10money<- formattable(t10pga$t10money, format = "f", digits = 2) 
t10pga$t10drive<- formattable(t10pga$t10drive, format = "f", digits = 1)

allpga$gir<- formattable(allpga$gir, format = "f", digits = 1) 
allpga$avg_putts<- formattable(allpga$avg_putts, format = "f", digits = 1) 
allpga$avg_score<- formattable(allpga$avg_score, format = "f", digits = 1) 
allpga$official_winnings<- formattable(allpga$official_winnings, format = "f", digits = 2) 
allpga$avg_drive<- formattable(allpga$avg_drive, format = "f", digits = 1)

final1<- merge(allpga, t10pga)

final1$official_winnings<- formattable(final1$official_winnings, format = "f", digits = 1) 
final1$t10money<- formattable(final1$t10money, format = "f", digits = 1)

final1$Year <- ymd(final1$Year)

final1$Year <- as.Date(final1$Year)

final1 <- as.xts(final1 [, -1], order.by = final1$Year)

final1 <- cor(final1, method = "spearman") # pearson was also run with virtually the same results

corrplot(final1, type = "lower", cl.ratio = .1, tl.srt = 5, addCoef.col = "black", number.cex = 0.8)

final1<- title(
  "                    Final Correlations. ,
                 Top 10 and all Player Averages from 2010 to 2022", cex.main = 1,  outer = FALSE)


Clean Environment
# Final clean of environment 

remove(pga_data, t10_pga_data, merged_distance, merged_gir, merged_putts, merged_score, merged_money, allcor, allpga, t10cor, t10pga, final1)


Final Conclusions



   Note - Golf is a game that focuses on a lower number being positive and a larger number being negative. This can be explained in how the data selected relates to the original question of ” Does a longer Drive equal better scores and more tour earnings on the PGA Tour?“. The data selected goes like this. First if you drive the ball further then you should be closer to the green and have a”more accurate” approach to the green. Presumably now that you are on the green “more accurately” or closer to the pin, you have a better chance at fewer putts. Fewer putts mean a lower score generally. Lower scores equal a better chance at more earnings.

   - If we look at and compare the correlations of average drive and t10 drive over the last 13, years we can see that drives have a positive relation to greens in regulation or GIR. Which is a desired result, as we want a higher percentage of gir.

   - As we look at drives and putts we can see that the top 10 drivers have a mildly better correlation to drive length as compared to the average driver. Showing us that Longer drives do relate to fewer putts.

   - When it comes to scoring we can also see that the drive length does have a relation to lower scoring, possibly due to a better gir..

   - Finally for the average winnings the correlation remains about the same at a 0.3. That said longer drivers do in fact earn more than the average driver, likely due to a better gir, fewer putts and better scores.


- Based on these finding I feel confident in saying that the data shows us that yes, Drive length does have a positive relation to gir and putts thus resulting in lower scores and a better chance at greater earnings on the PGA tour.


Actions


Based on these findings working on the following parts of your game should improve your score.

   - Work on a longer drive as it should give a better chance at improved gir.

   - If drive length is not something that you can greatly impact then work on you approach shots to improve gir.

   - Definitely work on putting! Honestly if you can’t putt, it doesn’t matter how far you can hit a ball! This part is from experience more so from just a data perspective. Data is always only part of the answer.

*The data here shows correlations but NOT causation. The Logest driver in a tournament does not always end up with the best score and win the most money.

So as the saying goes Drive for show and Putt for Dough!



Acknowledgements and Inspiration Credits


Coursera Google analytics Certification
Kun Ren for Formattable package