Scenario 1
Jourdan Jerome, Kateryna Louchnikov, Alyssa Nguyen

Joining Datasets

flu_vax <- flu %>%
  full_join(vax, by = c("county","demographic_value","demographic_category","quarter"))

str(flu_vax)
## tibble [3,627 × 12] (S3: tbl_df/tbl/data.frame)
##  $ county                      : chr [1:3627] "Alameda" "Alameda" "Alameda" "Alameda" ...
##  $ demographic_value           : chr [1:3627] "0-17" "0-17" "0-17" "0-17" ...
##  $ quarter                     : chr [1:3627] "2022-07-01" "2022-10-01" "2023-01-01" "2023-04-01" ...
##  $ new_infections              : int [1:3627] 3 21974 115912 8102 314 46647 259379 18883 320 22962 ...
##  $ new_severe                  : int [1:3627] 0 16 105 19 0 159 1597 342 0 380 ...
##  $ demographic_category        : chr [1:3627] "Age Group" "Age Group" "Age Group" "Age Group" ...
##  $ pop.x                       : int [1:3627] 338015 338015 338015 338015 752145 752145 752145 752145 318485 318485 ...
##  $ pop.y                       : int [1:3627] 340355 340355 340355 340355 754988 754988 754988 754988 317128 317128 ...
##  $ total_partial_vaccinated    : int [1:3627] 22036 21537 21291 22328 53631 59921 61705 62723 16985 19324 ...
##  $ cumulative_fully_vaccinated : int [1:3627] 202047 210053 213845 214952 668100 669131 669812 669899 283189 283420 ...
##  $ cumulative_at_least_one_dose: int [1:3627] 224135 231649 235199 237343 721745 729067 731531 732636 300174 302744 ...
##  $ cumulative_up_to_date_vax   : int [1:3627] 3994 44071 57415 65655 42320 184444 208970 218520 21850 107159 ...

Visualizations

Table: Rates of Severe Flu and Total Partially Vaccinated for COVID-19 by Demographic Group

flu_vax_rate_by_demo <- flu_vax %>%
  group_by(demographic_category,demographic_value) %>%
  summarise(new_severe = sum(new_severe, na.rm = TRUE),
            total_partial_vaccinated = sum(total_partial_vaccinated, na.rm = TRUE)) %>%
  ungroup() %>%
  left_join(flu_pop_demo_state, by = "demographic_value") %>%
  left_join(vax_pop_demo_state, by = "demographic_value") %>%
  mutate(rate_severe = round((new_severe/pop.x)*1000,2),
         rate_partial_vaccinated = round((total_partial_vaccinated/pop.y)*1000,2)) %>%
  select(demographic_value, rate_severe, rate_partial_vaccinated) %>%
  drop_na()

str(flu_vax_rate_by_demo)
## tibble [13 × 3] (S3: tbl_df/tbl/data.frame)
##  $ demographic_value      : chr [1:13] "0-17" "18-49" "50-64" "65+" ...
##  $ rate_severe            : num [1:13] 0.45 2.84 13.68 34.33 10.19 ...
##  $ rate_partial_vaccinated: num [1:13] 217 357 285 286 293 ...
kable(flu_vax_rate_by_demo,longtable = TRUE, booktabs = TRUE, col.names = c("Demographic Group", "Severe Flu", "COVID Vaccination"), caption = "Rates of Severe Flu and COVID Vaccination by Demographic Group, California, Quarter 3 2022 - Quarter 2 2023") %>%
  kable_styling(full_width = FALSE) %>%
  kable_styling(position = "left") %>%
  kable_styling(font_size = 10) %>%
  add_header_above(c(" "=1,"Rate per 1,000 population"=2)) %>%
  pack_rows("Age Group",1,4)%>%
  pack_rows("Gender",5,6) %>%
  pack_rows("Race/Ethnicity",7,13) %>%
  collapse_rows(columns = 1, valign = "top") %>%
  # add_footnote("Rates are per 1,000 population", notation = "none") %>%
  add_footnote("Based on flu diagnosis date and COVID-19 vaccination report date from Quarter 3 2022 - Quarter 2 2023", notation = "none")
Rates of Severe Flu and COVID Vaccination by Demographic Group, California, Quarter 3 2022 - Quarter 2 2023
Rate per 1,000 population
Demographic Group Severe Flu COVID Vaccination
Age Group
0-17 0.45 217.02
18-49 2.84 357.28
50-64 13.68 284.54
65+ 34.33 286.36
Gender
Female 10.19 292.81
Male 9.07 309.78
Race/Ethnicity
American Indian or Alaska Native, Non-Hispanic 10.32 324.82
Asian, Non-Hispanic 10.59 264.39
Black, Non-Hispanic 9.46 224.38
Hispanic (any race) 6.79 273.90
Multiracial (two or more of above races), Non-Hispanic 5.72 88.75
Native Hawaiian or Pacific Islander, Non-Hispanic 8.59 365.53
White, Non-Hispanic 12.59 205.33
Based on flu diagnosis date and COVID-19 vaccination report date from Quarter 3 2022 - Quarter 2 2023

Interpretation: By age group, severe flu incidence increases with older age groups and vaccination is lowest in the youngest group (0-17 years). By race/ethnicity, severe flu incidence is highest within the White, non-Hispanic group and vaccination is lowest in the Multi-racial group followed by the White, non-Hispanic group.

Scatterplot: County Rates of Severe Flu and Total Partially Vaccinated for COVID-19

flu_vax_by_county <- flu_vax %>%
  filter(demographic_category == "Gender") %>%
  group_by(county) %>%
  summarise(new_severe = sum(new_severe, na.rm = TRUE),
            total_partial_vaccinated = sum(total_partial_vaccinated, na.rm = TRUE)) %>%
  ungroup() %>%
  left_join(flu_pop_county, by = "county") %>%
  left_join(vax_pop_county, by = "county") %>%
  mutate(rate_severe = round((new_severe/pop.x)*1000,2),
         rate_partial_vaccinated = round((total_partial_vaccinated/pop.y)*1000,2)) %>%
  filter(county != "Imperial")

str(flu_vax_by_county)
## tibble [57 × 7] (S3: tbl_df/tbl/data.frame)
##  $ county                  : chr [1:57] "Alameda" "Alpine" "Amador" "Butte" ...
##  $ new_severe              : int [1:57] 16370 11 569 2299 644 217 11996 259 2369 8363 ...
##  $ total_partial_vaccinated: int [1:57] 470457 271 7241 43824 7711 4915 254420 6890 46354 262814 ...
##  $ pop.x                   : int [1:57] 1689538 1139 38161 227736 44150 22872 1168294 26792 190012 1029118 ...
##  $ pop.y                   : int [1:57] 1678334 1133 37986 226910 44153 22786 1159507 26840 189089 1021649 ...
##  $ rate_severe             : num [1:57] 9.69 9.66 14.91 10.1 14.59 ...
##  $ rate_partial_vaccinated : num [1:57] 280 239 191 193 175 ...
plot_ly(
  flu_vax_by_county,
  x = ~rate_partial_vaccinated,
  y = ~rate_severe,
  type = "scatter",
  mode = "markers",
  marker = list(color = "darkcyan", line = list(color = "darkslateblue", width = 2)),  
  text = ~paste('County: ', county, '<br>COVID Vaccination: ', rate_partial_vaccinated, '<br>Severe Flu: ', rate_severe),
  hoverinfo = "text"
) %>%
  layout(
    title = "County Rates of Severe Flu and Total Partially Vaccinated for COVID-19, California, 2022-2023",
    titlefont = list(size = 13),
    yaxis = list(title = "Severe Flu Rate per 1,000"),
    xaxis = list(title = "Total Partially Vaccinated for COVID-19 Rate per 1,000")
  )

Interpretation: There is not a strong correlation at the county-level between rates of severe flu and total partially vaccinated for COVID-19. Severe flu rates ranged from 7.1 to 15.8 per 1,000, and COVID-19 vaccination ranged from 114.34 to 452.69 per 1,000. The data point for Imperial County was excluded due to outliner value (COVID-19 vaccination rate is 1728.22 per 1,000 population).

Faceted Subplot: Rates of Severe Flu Incidence and Total Partially Vaccinated for COVID-19 by Race/Ethnicity, California

flu_vax_race <- full_join(flu_rate_by_race, vax_rate_by_race, by = "demographic_value")
str (flu_vax_race)
## tibble [7 × 13] (S3: tbl_df/tbl/data.frame)
##  $ demographic_category.x      : chr [1:7] "Race/Ethnicity" "Race/Ethnicity" "Race/Ethnicity" "Race/Ethnicity" ...
##  $ demographic_value           : chr [1:7] "American Indian or Alaska Native, Non-Hispanic" "Asian, Non-Hispanic" "Black, Non-Hispanic" "Hispanic (any race)" ...
##  $ new_infections              : int [1:7] 75649 2265330 998714 6881294 489921 62301 6581767
##  $ new_severe                  : int [1:7] 1808 55459 21849 108147 6477 1240 191714
##  $ pop.x                       : int [1:7] 175237 5237912 2310783 15917310 1132341 144374 15228046
##  $ rate_infections             : num [1:7] 432 432 432 432 433 ...
##  $ rate_severe                 : num [1:7] 10.32 10.59 9.46 6.79 5.72 ...
##  $ demographic_category.y      : chr [1:7] "Race/Ethnicity" "Race/Ethnicity" "Race/Ethnicity" "Race/Ethnicity" ...
##  $ total_partial_vaccinated    : int [1:7] 50970 1595154 479987 4346007 146065 50816 2868801
##  $ cumulative_at_least_one_dose: int [1:7] 406021 20599928 5567628 40127479 3818111 539958 42760590
##  $ pop.y                       : int [1:7] 156918 6033448 2139212 15867358 1645764 139020 13971549
##  $ rate_total_partial          : num [1:7] 324.8 264.4 224.4 273.9 88.8 ...
##  $ rate_cum_one_dose           : num [1:7] 2587 3414 2603 2529 2320 ...
plot1 <- plot_ly(flu_vax_race,
                 x = ~demographic_value,
                 y = ~rate_severe,
                 name = "Severe Flu",
                 type = "bar",
                 marker = list(color = "darkcyan"))

plot2 <- plot_ly(flu_vax_race,
                 x = ~demographic_value,
                 y = ~rate_total_partial,
                 name = "COVID Partially Vaccinated",
                 type = "bar",
                 marker = list(color = "darkslateblue"))

subplot(plot1, plot2, nrows = 2, shareX = TRUE) %>%
    layout(
    title = "Rates of Severe Flu and COVID Partially Vaccinated by Race/Ethnicity, California, 2022-2023",
    titlefont = list(size = 13),
    yaxis2 = list(title = "Severe Flu Rate per 1,000"),
    xaxis = list(title = "")
  )

Interpretation: There is no strong correlation between rates of severe flu and total partially vaccinated for COVID-19 between different racial/ethnic groups. Severe flu rates were lowest among the Multiracial group (5.72 per 1,000) and highest among the White, non-Hispanic group (12.59 per 1,000). Total partially vaccinated rates were also lowest among the Multiracial group (88.75 per 1,000) and highest among the Native Hawaiian/Pacific Islander group (365.53 per 1,000).

Bar Chart: Rates of Total Partially Vaccinated for COVID-19 and Newly Flu Diagnosed by Quarter, California, 2022-2023

flu_vax_quarter <- inner_join (vax_rate_by_quarter,flu_rate_by_quarter, by ="quarter")
str(flu_vax_quarter)
## tibble [4 × 13] (S3: tbl_df/tbl/data.frame)
##  $ quarter                     : chr [1:4] "2022-07-01" "2022-10-01" "2023-01-01" "2023-04-01"
##  $ total_partial_vaccinated    : int [1:4] 2794737 3025404 3103781 3174146
##  $ cumulative_at_least_one_dose: int [1:4] 31324176 31676214 31817154 31901015
##  $ county.x                    : chr [1:4] "California" "California" "California" "California"
##  $ pop.x                       : int [1:4] 39953269 39953269 39953269 39953269
##  $ rate_total_partial          : num [1:4] 70 75.7 77.7 79.5
##  $ rate_cum_one_dose           : num [1:4] 784 793 796 798
##  $ new_infections              : int [1:4] 12492 2848876 13539022 954586
##  $ new_severe                  : int [1:4] 0 30854 292420 63420
##  $ county.y                    : chr [1:4] "California" "California" "California" "California"
##  $ pop.y                       : int [1:4] 40146003 40146003 40146003 40146003
##  $ rate_infections             : num [1:4] 0.31 70.96 337.24 23.78
##  $ rate_severe                 : num [1:4] 0 0.77 7.28 1.58
plot_ly(flu_vax_quarter, x = ~quarter, y = ~rate_total_partial, type = "bar", name = "Partial COVID Vaccination", marker = list(color = "darkcyan")) %>%
  add_trace(x = ~quarter, y = ~rate_infections, type = "bar", name = "Flu Diagnosed", marker = list(color = "darkslateblue")) %>%
  layout(
    title = "Rates of Partially COVID Vaccinated and Newly Flu Diagnosed by Quarter, California, 2022-2023",
    titlefont = list(size = 13),
    yaxis = list(title = "Rate per 1,000"),
    xaxis = list(title = "Quarter Beginning"),
    plot_bgcolor = "white"
  )

Interpretation: The chart above shows that rates of newly flu diagnosis per 1,000 individuals do not have a strong correlation with rates of partially COVID vaccination per 1,000 individuals across quarters from July 2022 to April 2023. The observed increase in flu diagnosis rates during the second quarter and the largest spike in the third quarter may be attributed to the flu season.