我想比较 R 中四个 roc 曲线的 auc。我试过了roc.test,但是这个函数只能比较两条曲线
roc.test(roc1,roc2)
Run Code Online (Sandbox Code Playgroud)
R 是否具有比较四个曲线的功能?我知道在 stata 中我可以比较 4 条曲线roccomp。有谁知道如何比较R中的四个曲线?
谢谢!!
我正在尝试在 ggplot 中生成热图。我希望每个组都有不同的颜色渐变,但不知道该怎么做。我当前的代码如下所示:
## dummy data -----------------------------------------------------------------------------
data <- data.frame(
group = sample(c("Direct Patient Care", "Indirect Patient Care", "Education", "Rounds", "Handoff", "Misce"), 30, replace = T),
pct = rnorm(30, mean = 50, sd = 8)
)
## generate group id
data <- data %>%
group_by(group) %>%
mutate(id = row_number())
data$grpid <- with(data, ifelse(group == "Direct Patient Care", 1, ifelse(group == "Indirect Patient Care", 2,
ifelse(group == "Education", 3,
ifelse(group == "Rounds", 4,
ifelse(group == "Handoff", 5,6 ))))))
## draw graph …Run Code Online (Sandbox Code Playgroud) 我正在处理的数据是一个聚类数据,在一个组内有多个观察,我生成了一个毛虫图并希望为每个组标记(zipid),而不是每一行,我当前的图形和代码如下所示:
text = hosp_new[,c("zipid")]
ggplot(hosp_new, aes(x = id, y = oe, colour = zipid, shape = group)) +
# theme(panel.grid.major = element_blank()) +
geom_point(size=1) +
scale_shape_manual(values = c(1, 2, 4)) +
geom_errorbar(aes(ymin = low_ci, ymax = high_ci)) +
geom_smooth(method = lm, se = FALSE) +
scale_linetype_manual(values = linetype) +
geom_segment(aes(x = start_id, xend = end_id, y = region_oe, yend = region_oe, linetype = "4", size = 1.2)) +
geom_ribbon(aes(ymin = region_low_ci, ymax = region_high_ci), alpha=0.2, linetype = "blank") +
geom_hline(aes(yintercept …Run Code Online (Sandbox Code Playgroud)