简体   繁体   中英

R survdiff order of groups

If I have a survdiff object in R, is there a quick way to determine which group has the best survival (if there is a significant difference)?

Basically, I am looping over the rows of a data frame and getting the survdiff p value each time, but I really am only interested in the p value if a particular group shows the best survival.

I found the answer.

For a survdiff object y = (formula = Surv(stime, event) ~ tclass), y$obs/y$exp, the observed/expected events, will be lowest for the group with the best survival, highest for the group with the best survival, and so on. These values are ordered by the names stored in names(y$n), so you can check what the name of the best-survival group is by:

names(y$n)[y$obs/y$exp==min(y$obs/y$exp)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM