简体   繁体   English

从汇总图创建生存曲线

[英]Creating survival curve from summary plot

The software that I am using gives the summary output of the survfit function.我使用的软件提供了 survfit 函数的摘要输出。 What is the easiest way to take this information and use the ggsurvplot function?获取此信息并使用 ggsurvplot 函数的最简单方法是什么? I understand that this summary data is in a different format from the traditional data frame for the ggsurvplot function.我知道此摘要数据的格式与 ggsurvplot 函数的传统数据框格式不同。 Is there another function I should be using instead for a Kaplan-Meier Curve?我应该使用另一个函数来代替 Kaplan-Meier 曲线吗? Any information would be much appreciated.任何信息将不胜感激。 Notably, the survival probabilities round to 1 in the summary output, so it would be great if I could use the n.risk and n.event columns to calculate more accurate survivals.值得注意的是,汇总输出中的生存概率舍入为 1,因此如果我可以使用 n.risk 和 n.event 列来计算更准确的生存,那就太好了。 Thanks!谢谢!

Screenshot below:截图如下: 在此处输入图片说明

structure(list(time = c(11L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 
20L, 21L), n.risk = c(399490L, 399133L, 398853L, 398558L, 398078L, 
397755L, 397487L, 397273L, 397108L, 396949L), n.event = c(1L, 
1L, 3L, 2L, 2L, 1L, 2L, 3L, 2L, 6L), survival = c(1, 1, 1, 1, 
1, 1, 1, 1, 1, 1), std.err = c(2.5e-06, 3.54e-06, 5.6e-06, 6.63e-06, 
7.52e-06, 7.93e-06, 8.69e-06, 9.73e-06, 1.04e-05, 1.21e-05), 
    lowerci = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), upperci = c(1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1)), row.names = c(NA, -10L), class = "data.frame")
````

Not sure if you can recreate the survplot without the original data, eg using the built-in lung dataset:不确定是否可以在没有原始数据的情况下重新创建 survplot,例如使用内置的肺数据集:

library(survival)
library(survminer)
#> Loading required package: ggplot2
#> Loading required package: ggpubr
#> 
#> Attaching package: 'survminer'
#> The following object is masked from 'package:survival':
#> 
#>     myeloma

fit <- survfit(Surv(time, status) ~ sex, data = lung)

# Create a 'summary object'
sum_fit <- summary(fit)

df1 <- data.frame(time=fit$time,
                  nRisk=fit$n.risk,
                  nRiskRel=fit$n.risk/max(fit$n.risk))  

df2 <- data.frame(time_sum=sum_fit$time,
                  nRisk_sum=sum_fit$n.risk,
                  nRiskRel_sum=sum_fit$n.risk/max(sum_fit$n.risk))

ggplot1 <- ggsurvplot(fit, data = lung)$plot
ggplot1 +
  geom_point(aes(x=time, y=nRiskRel), data = df1, alpha=0.5, size=3) +
  geom_point(aes(x=time_sum, y=nRiskRel_sum), data = df2, alpha=0.5, size=3, color="blue")

nrow(df1)
#> [1] 206
nrow(df2)
#> [1] 150

Created on 2021-10-13 by the reprex package (v2.0.1)reprex 包(v2.0.1) 于 2021 年 10 月 13 日创建

There are fewer points in the summary object ('sum_fit') than the original data ('fit').汇总对象 ('sum_fit') 中的点比原始数据 ('fit') 少。 I think this may be a problem if you want to accurately recreate a survival curve plot.如果您想准确地重新创建生存曲线图,我认为这可能是一个问题。 There are also differences between the 'fit' and 'sum_fit' list objects that you would need to correct to use the ggsurvplot function. 'fit' 和 'sum_fit' 列表对象之间也存在差异,您需要更正以使用 ggsurvplot 函数。 I would be very interested to see if someone has a clever solution to this problem.我很想知道是否有人对这个问题有一个聪明的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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