R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

# exploration of data

heart <- read.csv("heart_disease.csv")

Introduction

How have heart disease death rates among U.S. adults changed since the turn of the 21st century?

Heart disease remains one of the leading causes of death in the United States. Although advances in prevention and treatment have reduced mortality over time, it is important to understand whether these improvements have occurred consistently across recent decades. Examining trends in heart disease mortality can help evaluate public health progress and identify areas where additional prevention efforts may be needed. This project uses the CDC’s Rates and Trends in Heart Disease and Stroke Mortality Among U.S. Adults (35+) by County, Age Group, Race/Ethnicity, and Sex (2000–2019) data set. The analysis focuses on the variables Year, Heart Disease Death Rate, Sex, and Age Group. The Year variable measures when mortality estimates were recorded, while the Heart Disease Death Rate provides the age-standardized death rate. The Sex and Age Group variables allow mortality trends to be compared across demographic groups. It is important to mention that the Heart Disease Death Rate encompasses a variety of cardiovascular diseases, shortened to cardiovascular disease for sake of simplicity and consistency.

To address our research question, the data set will be cleaned to select variables of interest needed for analysis. Descriptive statistics, such as the average heart disease mortality rates by year will be generated to summarize data. Further, a scatter plot will be created to display changes in rates over time from 1999 to 2019. A separate table for males and females will be created to compare mortality trends over time between sexes. Together, the summary statistics and visualizations will be used to determine whether heart disease death rates have increased, decreased, or remained stable during the study period.

# exploration of data
library(tidyverse)
library(ggplot2)
# cleaning dataset to perform EDA, selecting certain variables of note to create dataset needed

heart_clean <- heart |> 
  select(
    cvd_rate = "Data_Value", 
    age_range = "Stratification1", 
    sex = "Stratification3", 
    "Year"
    ) |> 
  filter(!is.na(cvd_rate),
  age_range == "Ages 35-64 years")
# creating summary table of average cardiovascular disease rate per year
trend <- heart_clean |> 
  group_by(Year) |>
  summarise(AverageRate = mean(cvd_rate, na.rm = TRUE))

trend
## # A tibble: 23 × 2
##    Year        AverageRate
##    <chr>             <dbl>
##  1 1999               87.6
##  2 1999 - 2010       -21.8
##  3 2000               86.3
##  4 2001               83.9
##  5 2002               83.1
##  6 2003               81.7
##  7 2004               77.1
##  8 2005               76.3
##  9 2006               74.6
## 10 2007               72.2
## # ℹ 13 more rows
# creation  of scatterplot 
ggplot(trend, 
       aes(x = Year,
           y = AverageRate)) +
  geom_line() +
  geom_point() + 
  labs(
    title = "Average Heart Disease Death Rate (2000-2019)",
    x = "Year",
    y = "Average Death Rate"
  ) +
  theme_minimal()
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?

# Comparison of males and females  / produces comparison of data by sex, per year, ranging from Men - Overall - Female

sex_trend <- heart_clean |>
  group_by(Year, sex) |> 
  summarise(
    AverageRate = mean(cvd_rate)
  )
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Year and sex.
## ℹ Output is grouped by Year.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Year, sex))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
sex_trend
## # A tibble: 69 × 3
## # Groups:   Year [23]
##    Year        sex     AverageRate
##    <chr>       <chr>         <dbl>
##  1 1999        Men           125. 
##  2 1999        Overall        86.6
##  3 1999        Women          53.9
##  4 1999 - 2010 Men           -20.4
##  5 1999 - 2010 Overall       -22.6
##  6 1999 - 2010 Women         -20.6
##  7 2000        Men           122. 
##  8 2000        Overall        85.5
##  9 2000        Women          53.1
## 10 2001        Men           118. 
## # ℹ 59 more rows

Conclusion

The analysis performed examines how cardiovascular disease rates changed in the United States between the years of 1999 to 2019. By summarizing mortality rates by year and visualizing the trend lines from the performed plots, it is possible to gauge whether heart disease deaths changed significantly with time. Upon analysis of the data used, it can be understood that rates of cardiovascular disease have slightly decreased since the turn of the 21st century. These findings are indicative that modern processes targeted against cardiovascular disease have been effective, promoting slow change as the current century has begun. Comparing trends by sex can also reveal whether a certain sex is more susceptible to cardiovascular disease. Such findings contribute to understanding long-term progress in improving cardiovascular mortality and may help guide future public health initiatives.

References

Centers for Disease Control and Prevention. (August, 2023). Rates and Trends in Heart Disease and Stroke Mortality Among US Adults (35+) by County, Age Group, Race/Ethnicity, and Sex – 2000-2019. DATA.GOV https://catalog.data.gov/dataset/rates-and-trends-in-heart-disease-and-stroke-mortality-among-us-adults-35-by-cou-2000-2019?from_hint=eyJxIjoiaGVhcnQgZGlzZWFzZSBzZXgiLCJzb3J0IjoicmVsZXZhbmNlIn0%3D