假设我有以下数据框
library(survival)
library(multcomp)
data(cml)
cml$group<-sample(1:5, 507, replace=T)
plot(survfit(Surv(time=cml$time, cml$status)~cml$group))
(survdiff(Surv(time=cml$time, cml$status)~cml$group))
如何比较例如group0与所有其他组进行多重比较测试?或者每个小组互相拥抱?
是否有一种很好的方式来绘制这些多重比较(例如plot.TukeyHSD()
中的aov()
?
答案 0 :(得分:1)
multcomp的generalsiminf.pdf中有一个例子。这里简化
library(multcomp)
library(survival)
if (!file.exists("AML_Bullinger.rda"))
load(url("http://www.stat.uni-muenchen.de/~hothorn/data/AML_Bullinger.rda", open = "r"))
risk <- rep(0, nrow(clinical))
rlev <- levels(clinical[, "Cytogenetic.group"])
risk[clinical[, "Cytogenetic.group"] %in% rlev[c(7,8,4)]] <- "low"
risk[clinical[, "Cytogenetic.group"] %in% rlev[c(5, 9)]] <- "intermediate"
risk[clinical[, "Cytogenetic.group"] %in% rlev[-c(4,5, 7,8,9)]] <- "high"
risk <- as.factor(risk)
names(clinical)[6] <- "FLT3"
save(clinical,file="AML_Bullinger.rda")
smod <- survreg(Surv(time, event) ~ Sex + Age + WBC+risk,
data = clinical)
summary(glht(smod, linfct = mcp(risk = "Tukey")))