Final Project

Author

N Pedraza

Load the Library

library(tidyverse) #contains readr
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.0     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.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
library(knitr)

Load the data set - official

setwd("/Users/nicolepedraza/Downloads/BioStat Final Project")
data <- read_csv("official.csv")
New names:
• `` -> `...10`
• `` -> `...11`
• `` -> `...12`
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
  dat <- vroom(...)
  problems(dat)
Rows: 48760 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (7): Data As Of, Start Date, End Date, State, Condition Group, Condition...
dbl (2): Year, COVID-19 Deaths
lgl (3): ...10, ...11, ...12

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
colnames(data)
 [1] "Data As Of"      "Start Date"      "End Date"        "Year"           
 [5] "State"           "Condition Group" "Condition"       "Age Group"      
 [9] "COVID-19 Deaths" "...10"           "...11"           "...12"          

Introduction

In January of 2020, the Centers for Disease Control and Prevention (CDC) documented the first laboratory-confirmed case of Coronavirus disease (COVID-19) in the United States (CDC, 2023). COVID-19, caused by the SARS-CoV-2 virus, is an infectious disease transmissible through droplet and airborne particles (WHO, n.d.). Due to its high transmissibility, certain groups, particularly older individuals and those with pre-existing conditions, face a higher risk of mortality if infected. Vaccination efforts in the U.S. commenced on December 14, 2020, aimed at curbing the spread of the virus. To ensure fair distribution, federal initiatives were implemented to reach vulnerable communities promptly (ASPA, 2024). As of April 2024, a total of 1,187,509 deaths have been reported (CDC, 2024)

Methods

The dataset on COVID-19 deaths sourced from the National Vital Statistics System relies on provisional counts and observational data collection methods. Significant biases include reporting inconsistencies across jurisdictions, disparities in healthcare access impacting testing and death attribution, and challenges in accurately attributing causation. These biases should be considered when interpreting the data’s implications for understanding the relationship between COVID-19 and other health factors.

Demographics

My dataset encompasses several variables. First, it includes the years 2020 to 2023, indicating the timeframe of the study. The condition groups consist of various pre-existing conditions such as respiratory diseases, circulatory diseases, sepsis, malignant neoplasms, diabetes, obesity, Alzheimer’s disease, vascular and unspecified dementia, renal failure, and others. Within these condition groups, specific conditions are delineated, including influenza and pneumonia, chronic lower respiratory diseases, and more. Age groups are categorized from 0-24 to 95+, capturing different age demographics. The dataset also incorporates states, spanning across the United States, enabling regional analysis. The final variable records the number of COVID-19 deaths, serving as the primary outcome measure for the study.

Hypothesis

The overarching question guiding my research is: Do patients diagnosed with influenza and pneumonia exhibit a greater propensity for mortality from COVID-19 when contrasted with individuals harbouring other pre-existing conditions throughout the period spanning 2020 to 2023?

Bar Plot:

unique(data$Condition)
 [1] "Influenza and pneumonia"                                                  
 [2] "Chronic lower respiratory diseases"                                       
 [3] "Adult respiratory distress syndrome"                                      
 [4] "Respiratory failure"                                                      
 [5] "Respiratory arrest"                                                       
 [6] "Other diseases of the respiratory system"                                 
 [7] "Hypertensive diseases"                                                    
 [8] "Ischemic heart disease"                                                   
 [9] "Cardiac arrest"                                                           
[10] "Cardiac arrhythmia"                                                       
[11] "Heart failure"                                                            
[12] "Cerebrovascular diseases"                                                 
[13] "Other diseases of the circulatory system"                                 
[14] "Sepsis"                                                                   
[15] "Malignant neoplasms"                                                      
[16] "Diabetes"                                                                 
[17] "Obesity"                                                                  
[18] "Alzheimer disease"                                                        
[19] "Vascular and unspecified dementia"                                        
[20] "Renal failure"                                                            
[21] "Intentional and unintentional injury, poisoning, and other adverse events"
[22] "All other conditions and causes (residual)"                               
[23] "COVID-19"                                                                 
covid_data <- data %>%
  filter(!is.na(`COVID-19 Deaths`)) %>%
  filter(Year >= 2020 & Year <= 2023) 
# A bar plot comparing the average number of COVID-19 deaths per year among patients with Influenza and pneumonia versus patients with other pre-existing conditions can provide a visual comparison.
covid_data2 <- covid_data %>%
  group_by(Condition, Year) %>%
  summarise(Total_Deaths = sum(`COVID-19 Deaths`))
`summarise()` has grouped output by 'Condition'. You can override using the
`.groups` argument.
head(covid_data)
# A tibble: 6 × 12
  `Data As Of` `Start Date` `End Date`  Year State   `Condition Group` Condition
  <chr>        <chr>        <chr>      <dbl> <chr>   <chr>             <chr>    
1 09/24/2023   01/01/2021   12/31/2021  2021 Alabama Respiratory dise… Influenz…
2 09/24/2023   01/01/2023   09/23/2023  2023 Alabama Respiratory dise… Influenz…
3 09/24/2023   01/01/2020   12/31/2020  2020 Alabama Respiratory dise… Influenz…
4 09/24/2023   01/01/2021   12/31/2021  2021 Alabama Respiratory dise… Influenz…
5 09/24/2023   01/01/2022   12/31/2022  2022 Alabama Respiratory dise… Influenz…
6 09/24/2023   01/01/2020   12/31/2020  2020 Alabama Respiratory dise… Influenz…
# ℹ 5 more variables: `Age Group` <chr>, `COVID-19 Deaths` <dbl>, ...10 <lgl>,
#   ...11 <lgl>, ...12 <lgl>
ggplot(covid_data2, aes(x = Condition, y = Total_Deaths, fill = factor(Year))) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Total COVID-19 Deaths per Condition (2020-2023)",
       x = "Condition",
       y = "Deaths",
       fill = "Year") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

summary(covid_data2)
  Condition              Year       Total_Deaths   
 Length:92          Min.   :2020   Min.   :  1134  
 Class :character   1st Qu.:2021   1st Qu.: 18045  
 Mode  :character   Median :2022   Median : 50332  
                    Mean   :2022   Mean   : 96128  
                    3rd Qu.:2022   3rd Qu.: 88375  
                    Max.   :2023   Max.   :929750  

Scatter Plot:

# A scatter plot showing the trend in the proportion of COVID-19 deaths among patients with influenza and pneumonia compared to patients with other pre-existing conditions over the years can help visualize any consistent patterns or changes.

total_deaths <- covid_data %>%
  group_by(Year, Condition) %>%
  summarise(Total_Deaths = sum(`COVID-19 Deaths`), .groups = "drop")
# Plotting the scatter plot
ggplot(total_deaths, aes(x = Condition, y = Total_Deaths, color = factor(Year))) +
  geom_point() +
  scale_color_manual(values = c("2020" = "red", "2021" = "blue", "2022" = "green", "2023" = "purple")) +
  labs(title = "Total COVID-19 Deaths per Condition (2020-2023)",
       x = "Condition",
       y = "Total COVID-19 Deaths",
       color = "Year") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

summary(total_deaths)
      Year       Condition          Total_Deaths   
 Min.   :2020   Length:92          Min.   :  1134  
 1st Qu.:2021   Class :character   1st Qu.: 18045  
 Median :2022   Mode  :character   Median : 50332  
 Mean   :2022                      Mean   : 96128  
 3rd Qu.:2022                      3rd Qu.: 88375  
 Max.   :2023                      Max.   :929750  

Box Plot:

A box plot showing the distribution of COVID-19 deaths among patients with influenza and pneumonia versus patients with other pre-existing conditions across different age groups can help identify any significant differences in the impact of COVID-19 within different age groups.

# Filter data for influenza and pneumonia and other pre-existing conditions
influenza_pneumonia_data <- subset(covid_data, Condition == "Influenza and pneumonia")
other_conditions_data <- subset(covid_data, Condition != "Influenza and pneumonia" & Condition != "COVID-19")
IP <- influenza_pneumonia_data %>%
  group_by(`Age Group`) %>%
  summarise(total = sum(`COVID-19 Deaths`))

Summary Statistics I will calculate:

  • Mean, median, and standard deviation of COVID-19 deaths per year for each pre-existing condition group to understand central tendency and variability.
  • Proportion of COVID-19 deaths attributed to influenza and pneumonia compared to other pre-existing conditions over the years to assess relative impact.
  • Distribution of COVID-19 deaths across different age groups within each condition group to examine age-related impacts.

Parameters to Estimate:

  • Relative risk of COVID-19 mortality associated with influenza and pneumonia compared to other pre-existing conditions.
  • Difference in mean COVID-19 deaths between patients with influenza and pneumonia versus other conditions.
  • Effect of age on COVID-19 mortality within each condition group.

Statistical Techniques I Will Use:

  • ANOVA (Analysis of Variance): To compare mean COVID-19 deaths across different pre-existing conditions and identify significant differences.
  • Logistic Regression: To assess the association between pre-existing conditions (including influenza and pneumonia) and COVID-19 mortality while controlling for potential confounders such as age.
  • Chi-Square Test: To examine the relationship between pre-existing conditions and COVID-19 mortality across different age groups, assessing whether the distribution of deaths differs significantly.

Conlusion

Will summarize my findings

Biblography

Centers for Disease Control and Prevention. (2024, April 19). CDC Covid Data tracker. Centers for Disease Control and Prevention. https://covid.cdc.gov/covid-data-tracker/#datatracker-home

Assistant Secretary for Public Affairs (ASPA). (2024, March 13). Covid-19 vaccines. HHS.gov. https://www.hhs.gov/coronavirus/covid-19-vaccines/index.html

Centers for Disease Control and Prevention. (2023, March 15). CDC Museum Covid-19 Timeline. Centers for Disease Control and Prevention. https://www.cdc.gov/museum/timeline/covid19.html

World Health Organization. (n.d.). Coronavirus. World Health Organization. https://www.who.int/health-topics/coronavirus#tab=tab_3