英文:
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 <- 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"))
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论