pacman::p_load(gt, haven, srvyr, survey, tidyverse,plotly )
P_DEMO <- read_xpt("https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/P_DEMO.XPT") %>%
filter(RIDAGEYR >= 18) %>%
select(SEQN, RIAGENDR, RIDAGEYR, RIDRETH3, INDFMPIR, SDMVPSU, SDMVSTRA, WTMECPRP, DMDEDUC2) %>%
mutate(
RIAGENDR = case_when(RIAGENDR == 1 ~ "Men",
RIAGENDR == 2 ~ "Women"),
RIDAGEYR = case_when(RIDAGEYR %in% 18:29 ~ "18-29",
RIDAGEYR %in% 30:44 ~ "30-44",
RIDAGEYR %in% 45:64 ~ "45-64",
RIDAGEYR %in% 65:79 ~ "65-79",
RIDAGEYR == 80 ~ "80 or more"),
RIDRETH3 = case_when(RIDRETH3 %in% 1:2 ~ "Hispanic",
RIDRETH3 == 3 ~ "Non-Hispanic White",
RIDRETH3 == 4 ~ "Non-Hisptanic Black",
RIDRETH3 == 6 ~ "Non-Hispanic Asian",
RIDRETH3 == 7 ~ "Other Race"),
DMDEDUC2 = case_when(DMDEDUC2 %in% 1:2 ~ "Less than high school",
DMDEDUC2 == 3 ~ "High school",
DMDEDUC2 == 4 ~ "Some college",
DMDEDUC2 == 5 ~ "College or more")
)
P_BPXO <- read_xpt("https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/P_BPXO.XPT") %>%
mutate(
systolic = rowMeans(cbind(BPXOSY1, BPXOSY2, BPXOSY3), na.rm = TRUE),
diastolic = rowMeans(cbind(BPXODI1, BPXODI2, BPXODI3), na.rm = TRUE),
stage2 = case_when(systolic >= 140 | diastolic >= 90 ~ TRUE,
!is.na(systolic) & !is.na(diastolic) ~ FALSE)
) %>%
select(SEQN, systolic, diastolic, stage2)
One <- left_join(P_DEMO, P_BPXO, by = "SEQN")
NHANES <- One %>%
filter(!is.na(stage2)) %>%
as_survey_design(id = SDMVPSU, strata = SDMVSTRA, nest = TRUE, weight = WTMECPRP)
c <- svyby(~stage2, "Total", NHANES, unwtd.count, keep.names = FALSE)
p <- svyby(~stage2, "Total", NHANES, svyciprop, vartype = "ci", method = "beta", keep.names = FALSE)
t1 <- inner_join(c, p)
## Joining, by = "by"
c <- svyby(~stage2, ~RIAGENDR, NHANES, unwtd.count, keep.names = FALSE)
p <- svyby(~stage2, ~RIAGENDR, NHANES, svyciprop, vartype = "ci", method = "beta", keep.names = FALSE)
t2 <- inner_join(c, p) %>% rename(by = RIAGENDR)
## Joining, by = "RIAGENDR"
t <- bind_rows(t1, t2) %>%
mutate(
by = factor(by, levels = c("Total", "Men", "Women")),
across(stage2:ci_u, ~ .x * 100)
) %>%
select(-se)
plot <- ggplot(t, aes(x = by, y = stage2, fill = by)) +
geom_col(alpha = 0.8, color = "#000000") +
geom_errorbar(aes(ymin = ci_l, ymax = ci_u), size = 1, width = 0.2) +
scale_fill_brewer(palette = "Blues") +
guides(fill = "none") +
labs(title = "Prevalence of Stage 2 Hypertension in Adults",
subtitle = "Total and By Gender",
x = element_blank(),
y = "Prevalence") +
theme_light() +
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
text = element_text(size = 20))
plot <- ggplotly(plot) %>%
layout(title = list(text = paste0("Prevalence of Stage 2 Hypertension in Adults",
"<br>",
"<sup>",
"Total and By Gender",
"</sup>")))
plot
chisq2 <- chisq.test(One$RIAGENDR,One$stage2)
chisq2
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: One$RIAGENDR and One$stage2
## X-squared = 2.8231, df = 1, p-value = 0.09292
c <- svyby(~stage2, ~RIDAGEYR, NHANES, unwtd.count, keep.names = FALSE)
p <- svyby(~stage2, ~RIDAGEYR, NHANES, svyciprop, vartype = "ci", method = "beta", keep.names = FALSE)
t <- inner_join(c, p) %>% rename(by = RIDAGEYR) %>%
mutate(across(stage2:ci_u, ~ .x * 100)) %>%
select(-se)
## Joining, by = "RIDAGEYR"
plot <- ggplot(t, aes(x = by, y = stage2, fill = by)) +
geom_col(alpha = 0.8, color = "#000000") +
geom_errorbar(aes(ymin = ci_l, ymax = ci_u), size = 1, width = 0.2) +
scale_fill_brewer(palette = "Blues") +
guides(fill = "none") +
labs(title = "Prevalence of Stage 2 Hypertension in Adults",
subtitle = "By Age Group",
x = element_blank(),
y = "Prevalence") +
theme_light() +
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
text = element_text(size = 20))
plot <- ggplotly(plot) %>%
layout(title = list(text = paste0("Prevalence of Stage 2 Hypertension in Adults",
"<br>",
"<sup>",
"By Age Group",
"</sup>"
)))
plot <- ggplotly(plot)
plot
chisq2 <- chisq.test(One$RIDAGEYR,One$stage2)
chisq2
##
## Pearson's Chi-squared test
##
## data: One$RIDAGEYR and One$stage2
## X-squared = 822.88, df = 4, p-value < 2.2e-16
c <- svyby(~stage2, ~RIDRETH3, NHANES, unwtd.count, keep.names = FALSE)
p <- svyby(~stage2, ~RIDRETH3, NHANES, svyciprop, vartype = "ci", method = "beta", keep.names = FALSE)
t <- inner_join(c, p) %>% rename(by = RIDRETH3) %>%
filter(by != "Other Race") %>%
mutate(across(stage2:ci_u, ~ .x * 100)) %>%
select(-se)
## Joining, by = "RIDRETH3"
plot <- ggplot(t, aes(x = by, y = stage2, fill = by)) +
geom_col(alpha = 0.8, color = "#000000") +
geom_errorbar(aes(ymin = ci_l, ymax = ci_u), size = 1, width = 0.2) +
scale_fill_brewer(palette = "Blues") +
guides(fill = "none") +
labs(title = "Prevalence of Stage 2 Hypertension in Adults",
subtitle = "By Hispanic Status & Race",
x = element_blank(),
y = "Prevalence") +
theme_light() +
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
text = element_text(size = 20, angle=60,hjust=1,vjust=0.5))
plot <- ggplotly(plot) %>%
layout(title = list(text = paste0("Prevalence of Stage 2 Hypertension in Adults",
"<br>",
"<sup>",
"Hispanic Status & Race",
"</sup>")))
plot <- ggplotly(plot)
plot
chisq2 <- chisq.test(One$RIDRETH3,One$stage2)
chisq2
##
## Pearson's Chi-squared test
##
## data: One$RIDRETH3 and One$stage2
## X-squared = 127.44, df = 4, p-value < 2.2e-16
c <- svyby(~stage2, ~DMDEDUC2, NHANES, unwtd.count, keep.names = FALSE)
p <- svyby(~stage2, ~DMDEDUC2, NHANES, svyciprop, vartype = "ci", method = "beta", keep.names = FALSE)
t <- inner_join(c, p) %>% rename(by = DMDEDUC2) %>%
mutate(across(stage2:ci_u, ~ .x * 100)) %>%
select(-se)
## Joining, by = "DMDEDUC2"
plot <- ggplot(t, aes(x = by, y = stage2, fill = by)) +
geom_col(alpha = 0.8, color = "#000000") +
geom_errorbar(aes(ymin = ci_l, ymax = ci_u), size = 1, width = 0.2) +
scale_fill_brewer(palette = "Blues") +
guides(fill = "none") +
labs(title = "Prevalence of Stage 2 Hypertension in Adults",
subtitle = "By Education",
x = element_blank(),
y = "Prevalence") +
theme_light() +
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
text = element_text(size = 18,angle=60,hjust=1,vjust=0.5))
plot <- ggplotly(plot) %>%
layout(title = list(text = paste0("Prevalence of Stage 2 Hypertension in Adults",
"<br>",
"<sup>",
"By Education",
"</sup>")))
plot <- ggplotly(plot)
plot
chisq2 <- chisq.test(One$DMDEDUC2,One$stage2)
chisq2
##
## Pearson's Chi-squared test
##
## data: One$DMDEDUC2 and One$stage2
## X-squared = 69.619, df = 3, p-value = 5.149e-15
References
GBD 2015 Risk Factors Collaborators. Global, regional, and national comparative risk assessment of 79 behavioral, environmental and occupational, and GBD 2015 Risk Factors Collaborators. Global, regional, and national comparative risk assessment of 79 behavioral, environmental and occupational, and metabolic risks or clusters of risks, 1990–2015: a systematic analysis for the global burden of disease study 2015. Lancet2016; 388:1659–1724.
Whelton PK, Carey RM, Aronow WS, Casey DE Jr, Collins KJ, Dennison Himmelfarb C, DePalma SM, Gidding S, Jamerson KA, Jones DW, MacLaughlin EJ, Muntner P, Ovbiagele B, Smith SC Jr, Spencer CC, Stafford RS, Taler SJ, Thomas RJ, Williams KA Sr, Williamson JD, Wright JT Jr. 2017 ACC/AHA/AAPA/ABC/ACPM/AGS/APhA/ASH/ ASPC/NMA/PCNA guideline for the prevention, detection, evaluation, and management of high blood pressure in adults: a report of the American College of Cardiology/American Heart Association Task Force on Clinical Practice Guidelines. J Am Coll Cardiol 2017. doi: 10.1016/j.jacc.2017.11.005
Yechiam Ostchega, Guangyu Zhang, Jeffery P. Hughes, and Tatiana Nwankwo. Factors Associated With Hypertension Control in US Adults Using 2017 ACC/AHA Guidelines: National Health and Nutrition Examination Survey 1999–2016. American Journal of Hypertension 31(8) August 2018. doi:10.1093/ajh/hpy047.
Ostchega Y, Fryar CD, Nwankwo T, Nguyen DT. Hypertension Prevalence Among Adults Aged 18 and Over: United States, 2017–2018. NCHS Data Brief, no 364. Hyattsville, MD: National Center for Health Statistics. 2020.