Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot survreg model #276

Open
HeidiSeibold opened this issue Jan 2, 2018 · 9 comments
Open

Plot survreg model #276

HeidiSeibold opened this issue Jan 2, 2018 · 9 comments

Comments

@HeidiSeibold
Copy link

It would be nice to be able to plot survreg models with your functions.

See e.g. this question on SO: https://stackoverflow.com/questions/43347376/include-weibull-fit-in-ggsurvplot

Creating a data.frame as from surv_summary does not help since the plot will still be shown as a step function.

## use data generating code from SO link
library("survival")
wbmod <- survreg(Surv(time, status) ~ x, data = dat)
s <- seq(.01, .99, by = .01)
t_0 <- predict(wbmod, newdata = data.frame(x = 0), 
                 type = "quantile", p = s)
t_1 <- predict(wbmod, newdata = data.frame(x = 1), 
                type = "quantile", p = s)

smod <- data.frame(time = c(t_0, t_1), 
                   surv = rep(1 - s, times = 2), 
                   strata = rep(c(0, 1), each = length(s)),
                   upper = NA, lower = NA)

library("survminer")
ggsurvplot(smod)  

rplot

@kassambara
Copy link
Owner

I will add this feature, thanks

@HeidiSeibold
Copy link
Author

Awesome, thanks! 🍰

@PhonePong
Copy link

To answer the question at stackoverflow, of overlaying theoretical Weibull fit to the ggsurvplot output, see the code in the above issue #281, although it points to some other issues regarding interaction between ggplot2 and ggsurvplot.

@HeidiSeibold
Copy link
Author

@kassambara do you have a timeline on when you think the feature will be available?
I would like to use your package for teaching an online course (which should hopefully give you lots of new users).

Let me know if I can help with anything.

@HeidiSeibold
Copy link
Author

Hi @kassambara. Any updates on this yet? Please let me know if I can help. I really need this 🤓 😅

@kassambara
Copy link
Owner

I think that, we can now close this issue. Fixed by your contribution #325

@HeidiSeibold
Copy link
Author

I think there could be something more user friendly, but it is ok for now. Thanks for merging ⭐

@kassambara
Copy link
Owner

so let's keep this issue open...

@kassambara kassambara reopened this Jul 25, 2018
@fthielen
Copy link

Any updates on this yet? I am still plotting KM curves and their parametric functions with base R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants