如何在R中使用cuRe包进行外推?

huangapple go评论80阅读模式
英文:

How to extrapolate using cuRe package in R?

问题

I am fitting a non-mixture cure model in R with splines, using the cuRe package. Here is my example:

dat <- cuRe::colonDC

non_mcm_spl_3df <- GenFlexCureModel(formula = Surv(FUyear, status) ~ 1,
                                    smooth.formula =  ~ ns(log(FUyear), df = 3),
                                    data = dat,
                                    type = "nmixture")

plot(non_mcm_spl_3df)

I wish to do this for multiple models and plot them all in a single plot using ggplot2. This is easy to do using flexsurv functions in R as you can use summary to extract coefficients specifying time points for extrapolation. I think it could be possible using predict here, but the output does not give me time points and I wish to extrapolate the model to 50-years on the graph, which I am not sure how to do. Any advice appreciated.

non_mcm_spl_3df_line <- as.data.frame(predict(non_mcm_spl_3df, type = "surv"))
英文:

I am fitting a non-mixture cure model in R with splines, using the cuRe package. Here is my example:

dat &lt;- cuRe::colonDC

non_mcm_spl_3df &lt;- GenFlexCureModel(formula = Surv(FUyear, status) ~ 1,
                                    smooth.formula =  ~ ns(log(FUyear), df = 3),
                                    data = dat,
                                    type = &quot;nmixture&quot;)

plot(non_mcm_spl_3df)

I wish to do this for multiple models and plot them all in a single plot using ggplot2. This is easy to do using flexsurv functions in R as you can use summary to extract coefficients specifying time points for extrapolation. I think it could be possible using predict here, but the output does not give me time points and I wish to extrapolate the model to 50-years on the graph, which I am not sure how to do. Any advice appreciated.

non_mcm_spl_3df_line &lt;- as.data.frame(predict(non_mcm_spl_3df, type = &quot;surv&quot;))

答案1

得分: 1

是的,可以通过predict函数实现这一功能。可以使用time参数来指定特定时间点的预测结果:

predict(fit.gen.timevar, time = c(2, 5, 50)).

predict函数可以提供多种功能。这可以通过type参数来指定,默认值是"surv",表示总生存。如果你想要绘制这些函数图,可以使用plot函数的time参数:

plot(non_mcm_spl_3df, time = seq(0.001, 50, length.out = 100))

plot函数调用了predict函数,因此type参数可以在这里以类似的方式使用。

英文:

Yes, this is possible via the predict function. Predictions at certain time points can be specified by using the time argument:

predict(fit.gen.timevar, time = c(2, 5, 50)).

The predict function can provide numerous functionals. This is specified via the type argument and the default is "surv", which is total survival. If you want to plot this functions, there is a time argument to the plot function:

plot(non_mcm_spl_3df, time = seq(0.001, 50, length.out = 100))

The plot function calls the predict function and thus the type argument can be used here in a similar fashion.

huangapple
  • 本文由 发表于 2023年6月15日 16:15:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480448.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定