UFC

Column

Introduction

Influences on a UFC Fight


What was I looking to find?

  • What is better a striker or a wrestler?
  • What external factors can influence the result of a UFC fight?

How will this be looked at?

  • Strike Attempts
  • Take Down Average
  • Overall Records
  • Reach

Strikers/Grapplers:Strikes/Min

Column

Strike Attempts Per Minute For Top Five Strikers

  • More than two strikes per minute
  • Five minutes per Round
  • Three to five rounds
  • 50 or more per fight


Result

Column

Strike Attempts Per Minute For Top Five Grapplers

  • Everyone, but Daniel Cormier
  • Less strikes thrown
  • Less exhausting


Result

Strikers/Grapplers:Takedown Avg.

Column

Take Down Average For Top Five Strikers

  • Not even 1 per match
  • Don’t look for the ground


Result

Column

Take Down Average For Top Five Grapplers

  • Higher average per match
  • Looking for the ground


Result

Strikes Absorbed:Top Fighters

Column

Strikes Absorbed For Top Grapplers and Strikers

  • Fairly even
  • Different styles but similar results

Column

Result

Record: Strikers/Grapplers

Column

Record For Top Five Strikers

  • Blue = Blue Fighter
  • Red = Red Fighter
  • More of a mixture


Result

Column

Record For Top Five Grapplers

  • Blue = Blue Fighter
  • Red = Red fighter
  • Less mixture of colors


Result

Reach:Red/Blue Fighter

Column

Reach in Fights (Advantage For Red Fighter)

  • Across all weights classes
  • Red had reach advantage
  • Resulted in wins


Result

Column

Reach in Fights (Advantage for Blue Fighter)

  • Across weight all classes
  • Blue had reach advantage
  • Did not result in wins


Result

---
title: "UFC Fight"
author: "Luke Keirn"
output: 
  flexdashboard::flex_dashboard:
    source_code: embed
    orientation: columns
    vertical_layout: fill
---


<style>
.chart-title 
  {  
    /* chart_title  */
    font-size: 18px;
    font-family: Arial;
  }
body
  {
      /* Normal  */
      font-size: 18px;
  }
</style>


```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(DT)
library(plotly)
raw_fighter_details <- read_csv("raw_fighter_details.csv")
data <- read.csv("data.csv")
```



UFC 
===

Column {data-width=1000}
---

### Introduction

<h1 style="font-size:3vw"><b>Influences on a UFC Fight</b></h1>
<br>

**What was I looking to find? **

- What is better a striker or a wrestler?
- What external factors can influence the result of a UFC fight?

**How will this be looked at?**

- Strike Attempts 
- Take Down Average
- Overall Records
- Reach


Strikers/Grapplers:Strikes/Min
===

Column {data-width=450}
---

### Strike Attempts Per Minute For Top Five Strikers

- More than two strikes per minute
- Five minutes per Round
- Three to five rounds 
- 50 or more per fight

<br>

#### Result

```{r plot1, fig.align= 'center', out.width="80%"}
library(ggplot2)

selected_fighters <- c("Conor McGregor", "Anderson Silva", "Israel Adesanya", "Max Holloway", "Jose Aldo")

striker_data <- raw_fighter_details[raw_fighter_details$fighter_name %in% selected_fighters, ]

ggplot(striker_data, aes(x = fighter_name, y = SApM, fill = SApM)) +
  geom_bar(stat = "identity", position = "dodge", width = 0.7) +
  scale_fill_gradient(low = "white", high = "blue", limits = c(1, NA)) +
  labs(x = "Fighter Names", y = "Strike Attempts Per Minute (SApM)", title = "SApM Distribution for Top 5 Strikers") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```


Column {data-width=450}
---

### Strike Attempts Per Minute For Top Five Grapplers

- Everyone, but Daniel Cormier
- Less strikes thrown
- Less exhausting

<br>

#### Result

```{r plot2, fig.align = 'center', out.width="80%"}
library(ggplot2)

selected_wrestlers <- c("George St. Pierre", "Matt Hughes", "Randy Couture", "Daniel Cormier", "Chael Sonnen")
wrestler_data <- raw_fighter_details[raw_fighter_details$fighter_name %in% selected_wrestlers, ]

ggplot(wrestler_data, aes(x = fighter_name, y = SApM, fill = SApM)) +
  geom_bar(stat = "identity", position = "dodge", width = 0.7) +
  scale_fill_gradient(low = "white", high = "blue", limits = c(1, NA)) +
  labs(x = "Fighter Names", y = "SApM", title = "SApM Distribution for Top 5 Grapplers") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```

Strikers/Grapplers:Takedown Avg.
===

Column {data-width=450}
---

### Take Down Average For Top Five Strikers

- Not even 1 per match
- Don't look for the ground

<br>

#### Result

```{r plot3, fig.align = 'center', out.width="80%"}
library(ggplot2)
selected_fighters <- c("Conor McGregor", "Anderson Silva", "Israel Adesanya", "Max Holloway", "Jose Aldo")
striker_data <- raw_fighter_details[raw_fighter_details$fighter_name %in% selected_fighters, ]
ggplot(striker_data, aes(x = fighter_name, y = TD_Avg)) +
  geom_tile(aes(fill = TD_Avg)) +
  scale_fill_gradient(low = "white", high = "blue", limits = c(1, NA)) + 
  labs(x = "Fighter Names", y = "TD_Avg", title = "TD_Avg Heatmap for Top 5 Strikers") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```


Column {data-width=450}
---

### Take Down Average For Top Five Grapplers

- Higher average per match
- Looking for the ground 


<br>

#### Result

```{r plot4, fig.align = 'center', out.width="80%"}
library(ggplot2)
selected_fighters <- c("George St. Pierre", "Matt Hughes", "Randy Couture", "Daniel Cormier", "Chael Sonnen")
striker_data <- raw_fighter_details[raw_fighter_details$fighter_name %in% selected_fighters, ]
ggplot(striker_data, aes(x = fighter_name, y = TD_Avg)) +
  geom_tile(aes(fill = TD_Avg)) +
  scale_fill_gradient(low = "white", high = "blue", limits = c(1, NA)) + 
  labs(x = "Fighter Names", y = "TD_Avg", title = "TD_Avg Heatmap for Top 5 Grapplers") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```

Strikes Absorbed:Top Fighters
===

Column {data-width=450}
---

### Strikes Absorbed For Top Grapplers and Strikers

- Fairly even 
- Different styles but similar results



Column {data-wdith=550}
---

### Result

```{r plot5, fig.align = 'center', out.width="80%"}
library(reshape2)

raw_fighter_details <- data.frame(
  fighter_name = c("George St. Pierre", "Matt Hughes", "Randy Couture", "Daniel Cormier", 
                   "Chael Sonnen", "Conor McGregor", "Anderson Silva", "Israel Adesanya", 
                   "Max Holloway", "Jose Aldo"),
  SApM = c(1.5, 2.0, 1.2, 1.8, 2.2, 2.5, 1.7, 1.6, 1.9, 1.4)
)

hc <- hclust(dist(raw_fighter_details$SApM), method = "average")

plot(hc, main = "Hierarchical Clustering for Strikes Absorbed",
     xlab = "Fighters", ylab = "SApM", labels = raw_fighter_details$fighter_name)
```

Record: Strikers/Grapplers
===

Column {data-width=450}
---

### Record For Top Five Strikers

- Blue = Blue Fighter
- Red = Red Fighter
- More of a mixture

<br>

#### Result

```{r plot6, fig.align = 'center', out.width="80%"}
library(ggplot2)

selected_fighters <- c("Anderson Silva", "Max Holloway", "Conor McGregor", "Israel Adesanya", "Jose Aldo")
selected_dates <- as.Date(c("2010-08-07", "2011-02-05", "2011-08-27", "2012-07-07", "2012-10-13",
                            "2013-07-06", "2013-12-28", "2015-01-31", "2016-02-27", 
                            "2016-07-09", "2017-02-11", "2019-02-09", "2019-05-11", "2020-10-03",
                            "2012-02-04", "2013-05-25", "2013-08-17", "2019-04-13", "2019-12-14",
                            "2020-07-11", "2016-03-05", "2018-10-06", "2021-01-23", 
                            "2021-03-06", "2015-12-12", "2017-06-03", "2017-12-02",
                            "2019-05-11", "2019-12-14", "2020-07-11"))

filtered_data <- data[(data$B_fighter %in% selected_fighters | data$R_fighter %in% selected_fighters) &
                        data$date %in% selected_dates, ]
filtered_data$color <- ifelse(filtered_data$date %in% c("2013-07-06", "2013-12-28", "2016-02-27", "2016-07-09", 
                                                        "2019-02-09", "2019-05-11", "2020-10-03", "2012-02-04", 
                                                        "2013-05-25", "2013-08-17", "2019-04-13", "2019-12-14", 
                                                        "2020-07-11", "2016-03-05", "2018-10-06", "2021-01-23", 
                                                        "2021-03-06", "2015-12-12", "2017-06-03", "2017-12-02",
                                                        "2019-05-11", "2019-12-14", "2020-07-11"),
                              "Red", "Blue")

ggplot(filtered_data, aes(x = date, y = Winner, color = color)) +
  geom_point() +
  scale_color_manual(values = c("Red" = "red", "Blue" = "blue")) +
  labs(x = "Date", y = "Winner", title = "Top Five Strikers Overall Record") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```


Column {data-width=450}
---

### Record For Top Five Grapplers

- Blue = Blue Fighter
- Red = Red fighter
- Less mixture of colors

<br>


#### Result

```{r plot7, fig.align = 'center', out.width="80%"}
library(ggplot2)

selected_fighters <- c("George St. Pierre", "Matt Hughes", "Randy Couture", "Daniel Cormier", "Chael Sonnen")

selected_dates <- as.Date(c("2004-10-22", "2007-04-07", "2000-12-16", "2004-01-31", "2006-11-18", 
                            "2007-12-29", "2008-06-07", "2010-11-20", "2002-03-22", "2002-09-27", 
                            "2004-01-31", "2005-04-16", "2006-02-04", "2008-11-15", "2009-08-29", 
                            "2011-04-30", "2015-01-03", "2019-08-17", "2005-10-07", "2006-05-27", 
                            "2009-02-21", "2010-08-07", "2012-07-07", "2013-04-27", "2013-11-16"))

filtered_data <- data[(data$B_fighter %in% selected_fighters | data$R_fighter %in% selected_fighters) &
                        data$date %in% selected_dates, ]

filtered_data$color <- ifelse(filtered_data$date %in% c("2004-10-22", "2007-04-07", "2000-12-16", "2004-01-31", 
                                                        "2006-11-18", "2007-12-29", "2008-06-07", "2010-11-20", 
                                                        "2002-03-22", "2002-09-27", "2004-01-31", "2005-04-16", 
                                                        "2006-02-04", "2008-11-15", "2009-08-29", "2011-04-30", 
                                                        "2015-01-03", "2019-08-17", "2005-10-07", "2006-05-27", 
                                                        "2009-02-21", "2010-08-07", "2012-07-07", "2013-04-27", 
                                                        "2013-11-16"),
                              "Red", "Blue")

ggplot(filtered_data, aes(x = date, y = Winner, color = color)) +
  geom_point() +
  scale_color_manual(values = c("Red" = "red", "Blue" = "blue")) +
  labs(x = "Date", y = "Winner", title = "Top Five Grapplers Overall Record") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
```

Reach:Red/Blue Fighter
===

Column {data-width=450}
---

### Reach in Fights (Advantage For Red Fighter)

- Across all weights classes 
- Red had reach advantage
- Resulted in wins


<br>

#### Result

```{r boxplot2, fig.align = 'center', out.width="80%"}
library(ggplot2)

filtered_data <- data[data$R_Reach_cms > data$B_Reach_cms, ]

win_counts <- table(filtered_data$Winner)

win_data <- data.frame(Winner = names(win_counts), Wins = as.numeric(win_counts))

ggplot(win_data, aes(x = reorder(Winner, -Wins), y = Wins, fill = Winner)) +
  geom_bar(stat = "identity") +
  labs(x = "Winner", y = "Number of Wins", title = "Red Wins With Reach Advantage") +
  theme_minimal()
```

Column {data-width=450}
---

### Reach in Fights (Advantage for Blue Fighter)

- Across weight all classes
- Blue had reach advantage
- Did not result in wins
  
<br>

#### Result

```{r boxplot3, fig.align = 'center', out.width="80%"}
library(ggplot2)

filtered_data <- data[data$B_Reach_cms > data$R_Reach_cms, ]

win_counts <- table(filtered_data$Winner)

win_data <- data.frame(Winner = names(win_counts), Wins = as.numeric(win_counts))

ggplot(win_data, aes(x = reorder(Winner, -Wins), y = Wins, fill = Winner)) +
  geom_bar(stat = "identity") +
  labs(x = "Winner", y = "Number of Wins", title = "Blue Wins With Reach Advantage") +
  theme_minimal()
```