Created new variables needed for analysis (minimum 2). We created “mean_pm25” which is the average pm2.5 for each county. We also created the median_ces_score, which is the median CalEnviroScreen score for each county.
Filtered the asthma dataset to 2020, children ages 0–4, and California’s 58 counties (excluding the statewide total). Checked for duplicate counties and confirmed that each county appeared only once. Examined missing data, identifying 19 counties with missing asthma ED visit counts and 58 with missing age-adjusted ED visit rates. Selected and renamed variables, retaining county and ED visit rate and renaming the latter asthma_ed_rate_0_4. Standardized county names by converting uppercase names to title case (e.g., ALAMEDA to Alameda) so they matched the environmental dataset. Merged the datasets using county as the common identifier, creating final_df with 58 counties and four variables. Checked the merged dataset for missing environmental and asthma values.
california_county age_adjusted_ed_visit_rate
1 AMADOR NA
2 CALAVERAS NA
3 COLUSA NA
4 DEL NORTE NA
5 EL DORADO NA
6 INYO NA
7 LASSEN NA
8 MARIPOSA NA
9 MENDOCINO NA
10 MODOC NA
11 MONO NA
12 NEVADA NA
13 PLUMAS NA
14 SAN BENITO NA
15 SISKIYOU NA
16 SUTTER NA
17 TEHAMA NA
18 TRINITY NA
19 TUOLUMNE NA
The following object is masked from 'package:dplyr':
group_rows
top_counties <- final_df %>%filter(!is.na(asthma_ed_rate_0_4)) %>%arrange(desc(asthma_ed_rate_0_4)) %>%slice_head(n =10) %>%transmute(County = california_county,`Asthma ED Rate`=round(asthma_ed_rate_0_4, 1),`Mean PM2.5`=round(mean_pm25, 2),`Median CES Score`=round(median_ces_score, 1) )knitr::kable( top_counties,format ="html",caption ="Top 10 California Counties by Pediatric Asthma ED Visit Rate, 2020",align =c("l", "r", "r", "r")) %>%kable_styling(bootstrap_options =c("striped", "hover"),full_width =FALSE,position ="center" ) %>%column_spec(1, bold =TRUE) %>%row_spec(0, bold =TRUE)
Top 10 California Counties by Pediatric Asthma ED Visit Rate, 2020
County
Asthma ED Rate
Mean PM2.5
Median CES Score
Fresno
70.6
13.18
42.8
Madera
67.5
11.40
41.3
Merced
53.4
11.70
43.7
Kings
50.0
13.65
40.7
San Joaquin
41.1
10.66
36.1
Lake
40.9
3.76
19.9
Solano
38.3
8.52
22.1
Stanislaus
32.7
11.30
37.1
Sacramento
32.4
8.76
23.3
Kern
32.0
13.46
39.6
Interpretation: Fresno, Madera, and Merced counties had the highest reported asthma emergency department visit rates among children ages 0–4 in 2020. Several counties with elevated asthma ED visit rates also had relatively high PM2.5 concentrations and CalEnviroScreen (CES) scores. There were some exceptions. Lake County, for example, has a high ED rate but low PM2.5 concentration and CES score, suggesting that factors beyond these environmental measures may be at play.
Correlation plots
library(ggplot2)Pearson_r <-cor(final_df$median_ces_score, final_df$asthma_ed_rate_0_4, use="complete.obs")ggplot(final_df, aes(x = median_ces_score, y = asthma_ed_rate_0_4)) +geom_point() +geom_smooth(method ="lm") +labs(title ="Median CES Score vs Adjusted Asthma Rates by County",x ="Median CES Score",y ="Adjusted Asthma Rate per 10,000" )
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 19 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 19 rows containing missing values or values outside the scale range
(`geom_point()`).
The scatter plot shows the correlation between adjusted asthma rates per county and median CES scores per county. The plot shows a correlation coefficient of 0.67 between the two variables, with most larger residuals present with higher median CES scores.