I’m going to be performing an analysis on the 2022-2023 NHL season data. This data contains information about shoot outs, games played, games won/loss, etc. Each row is an team and each column is a statistic that team. Learn more about this data at this link: https://data.scorenetwork.org/hockey/nhl_2223.html
hockey<-read_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/meyerratkeni_xavier_edu/Ecko0LcMGjJCsN1RZOK4RsoBmlTCgqaaHw_Yy1ehLWqZxQ?download=1")hist(hockey$GA,main ="Historgram of Goals Against",xlab ="Goals Against", ylab="Count")
hist(hockey$GF,main ="Historgram of Goals Scored",xlab ="Goals Scored", ylab="Count")
Analysis of Goals Scored vs. Goals Against
Questions
Do teams that score more goals tend to allow more or less goals against at the conference level?
Importance
The information presented in this visual is important because it can be used when planning game strategy, building a roster, to have better informed sports bets, predicting game outcomes, looking at overall conference trends, etc. Allows a team to see if they should focus on getting a better goalie or if they have strong enough shooters to offset their low save rate.
How will this question be answered ?
In order to answer this question, data from the 2022-2023 NHL season will be used. Specifically the variables: GA, GF, & Conference (mutated using data from ESPN). A scatter plot with a smoothing line will be used since both variables are continuous. Mutate function will be used to create a new variable called conference which will allow us to see if there are any significant differences at the conference level (will be used to color code). Lastly, facet_wrap will be used to have a side by side comparison by conference.
Data Wrangling
hockey %>%mutate(Conference =ifelse(Team %in%c("BOS","CAR","NJ","TOR","NYR","TB","NYI","FLA","PIT","BUF","OTT","DET","WSH","PHI","MTL","CB"),"Eastern", "Western"))
hockey %>%mutate(Conference =ifelse(Team %in%c("BOS","CAR","NJ","TOR","NYR","TB","NYI","FLA","PIT","BUF","OTT","DET","WSH","PHI","MTL","CB"),"Eastern", "Western")) %>%ggplot(aes(x= GA, y=GF, color=Conference))+geom_point()+labs(title ="Goals Against vs Goals Scored by Conference",subtitle ="2022-2023 Season", x="Goals Against",y="Goals Scored")+facet_wrap(~Conference)+geom_smooth(method=lm)
Interpretation
From this visual, we can see that the eastern and western conferences have similar trend lines with the western conf. being stepper due to have more teams with goals against above 300 and goals scored below 240. The western conference has an outlier around 340 goals scored and 260 goals against.
Source Code
---title: "An Analysis of the 2022-2023 NHL Season" # Name of your HTML outputsubtitle: "at the conference & divisional levels"author: "Bella M." # Author nametoc: true # Generates an automatic table of contents.format: # Options related to formatting. html: # Options related to HTML output. code-tools: TRUE # Allow the code tools option showing in the output. embed-resources: TRUE # Embeds all components into a single HTML file. execute: # Options related to the execution of code chunks. warning: FALSE # FALSE: Code chunk sarnings are hidden by default. message: FALSE # FALSE: Code chunk messages are hidden by default. echo: TRUE # TRUE: Show all code in the output.---## IntroductionI'm going to be performing an analysis on the 2022-2023 NHL season data. This data contains information about shoot outs, games played, games won/loss, etc. Each row is an team and each column is a statistic that team. Learn more about this data at this link: <https://data.scorenetwork.org/hockey/nhl_2223.html>```{r}#| label: Load Packages#| include: falselibrary(tidyverse) #for all the tidy packageslibrary(skimr) #for better summary statistics``````{r}#| label: Import Datahockey<-read_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/meyerratkeni_xavier_edu/Ecko0LcMGjJCsN1RZOK4RsoBmlTCgqaaHw_Yy1ehLWqZxQ?download=1")hist(hockey$GA,main ="Historgram of Goals Against",xlab ="Goals Against", ylab="Count")hist(hockey$GF,main ="Historgram of Goals Scored",xlab ="Goals Scored", ylab="Count")```## Analysis of Goals Scored vs. Goals Against#### Questions Do teams that score more goals tend to allow more or less goals against at the conference level?#### Importance The information presented in this visual is important because it can be used when planning game strategy, building a roster, to have better informed sports bets, predicting game outcomes, looking at overall conference trends, etc. Allows a team to see if they should focus on getting a better goalie or if they have strong enough shooters to offset their low save rate.#### How will this question be answered ? In order to answer this question, data from the 2022-2023 NHL season will be used. Specifically the variables: GA, GF, & Conference (mutated using data from ESPN). A scatter plot with a smoothing line will be used since both variables are continuous. Mutate function will be used to create a new variable called conference which will allow us to see if there are any significant differences at the conference level (will be used to color code). Lastly, facet_wrap will be used to have a side by side comparison by conference.#### Data Wrangling```{r}#| label: Data Wranglinghockey %>%mutate(Conference =ifelse(Team %in%c("BOS","CAR","NJ","TOR","NYR","TB","NYI","FLA","PIT","BUF","OTT","DET","WSH","PHI","MTL","CB"),"Eastern", "Western")) ```#### Visualization```{r}#| label: Visualizationhockey %>%mutate(Conference =ifelse(Team %in%c("BOS","CAR","NJ","TOR","NYR","TB","NYI","FLA","PIT","BUF","OTT","DET","WSH","PHI","MTL","CB"),"Eastern", "Western")) %>%ggplot(aes(x= GA, y=GF, color=Conference))+geom_point()+labs(title ="Goals Against vs Goals Scored by Conference",subtitle ="2022-2023 Season", x="Goals Against",y="Goals Scored")+facet_wrap(~Conference)+geom_smooth(method=lm)```#### InterpretationFrom this visual, we can see that the eastern and western conferences have similar trend lines with the western conf. being stepper due to have more teams with goals against above 300 and goals scored below 240. The western conference has an outlier around 340 goals scored and 260 goals against.####