Background
Data taken from https://www.nature.com/articles/s41591-024-02905-y/tables/6
library(ggplot2)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(tidyr)
a <- read.table("qrisk.csv", header = TRUE, sep = ",")
b <- subset(a, Model == "QR4") %>%
mutate(group = paste(Ethnicity, Sex)) %>%
arrange(desc(C_stat))
b$group <- factor(b$group, levels = b$group)
ggplot(b, aes(x = C_stat, y = group, colour = Sex)) +
geom_vline(xintercept = 0.75, linetype = "dashed", linewidth = 0.3) +
geom_errorbarh(
aes(xmin = CI_lower, xmax = CI_upper),
height = 0.18,
position = position_dodge(width = 0.6)
) +
geom_point(
position = position_dodge(width = 0.6),
size = 2
) +
scale_x_continuous(
limits = c(0.65, 0.92),
breaks = seq(0.65, 0.90, 0.05)
) +
labs(
x = "C statistic (95% CI)",
y = NULL
)
Warning: `geom_errorbarh()` was deprecated in ggplot2 4.0.0.
ℹ Please use the `orientation` argument of `geom_errorbar()` instead.
`height` was translated to `width`.
R version 4.6.0 (2026-04-24)
Platform: aarch64-apple-darwin23
Running under: macOS Sequoia 15.2
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/London
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_1.3.2 dplyr_1.2.1 ggplot2_4.0.3
loaded via a namespace (and not attached):
[1] vctrs_0.7.3 cli_3.6.6 knitr_1.51 rlang_1.2.0
[5] xfun_0.57 otel_0.2.0 purrr_1.2.2 generics_0.1.4
[9] S7_0.2.2 jsonlite_2.0.0 glue_1.8.1 htmltools_0.5.9
[13] scales_1.4.0 rmarkdown_2.31 grid_4.6.0 tibble_3.3.1
[17] evaluate_1.0.5 fastmap_1.2.0 yaml_2.3.12 lifecycle_1.0.5
[21] compiler_4.6.0 RColorBrewer_1.1-3 pkgconfig_2.0.3 htmlwidgets_1.6.4
[25] farver_2.1.2 digest_0.6.39 R6_2.6.1 tidyselect_1.2.1
[29] pillar_1.11.1 magrittr_2.0.5 withr_3.0.2 tools_4.6.0
[33] gtable_0.3.6