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

Simplifying ggsurvplot #154

Closed
kassambara opened this issue Feb 26, 2017 · 8 comments
Closed

Simplifying ggsurvplot #154

kassambara opened this issue Feb 26, 2017 · 8 comments

Comments

@kassambara
Copy link
Owner

No description provided.

@kassambara
Copy link
Owner Author

kassambara commented Feb 26, 2017

Now ggsurvplot() returns list, which can contain four components:

ggsurv$plot # survival curves
ggsurv$table # risk table
ggsurv$cumevents # cumulative number of events
ggsurv$ncensor.plot # ncensor plot

Adding extra arguments in ggsurvplot(), to change the graphical parameters - title, subtitle, caption and font - of each of these components, will make the ggsurvplot() doc hard to read.

For any hyper-customization of ggsurvplot components, users should use either the function ggplot2::labs() or the function ggpubr::ggpar() as demontrated in the README file.

the function ggpar() provides, with less typing, a convenient way to play with fonts and palettes (custom color, RColorBrewer and ggsci color palettes)

@kassambara
Copy link
Owner Author

Backward compatibility will be preserved with upcoming changes

@kassambara
Copy link
Owner Author

Creating the ggrisktable() helper function to make ggsurvplot() cleaner. Normally, users don't need to use this function directly. Internally used by the ggsurvplot() function

@kassambara
Copy link
Owner Author

New function ggrisktable() added

# Fit survival curves
library(survival)
fit2 <- survfit( Surv(time, status) ~ rx + adhere,
                 data = colon )


# Plotting the survival curves
library(survminer)
ggrisktable(fit2, data = colon,  color = "strata", palette = "jco")

rplot03

@kassambara
Copy link
Owner Author

kassambara commented Feb 27, 2017

Now, the output of ggsurvplot() can look like this:

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

library(survminer)
ggsurvplot(fit, data = lung,
           risk.table = TRUE,
           risk.table.title = "No at Risk",
           cumevents = TRUE,
           cumevents.title = "Cumulative No of Events",
           ncensor.plot = TRUE,
           ncensor.plot.title = "No of Censored Subjects",
           palette = "jco",
           risk.table.height = 0.2,
           cumevents.height = 0.2,
           ncensor.plot.height = 0.2
           )

rplot

The ncensor plot, based on raw timing, is not easy to read. This can be even more difficult in the situation, where the number of strata >= 3. To resolve this problem, @pbiecek implement a very convenient solution in ggsurvevents().

One could also display the cumulative number of censored subjects as a table.

@kassambara
Copy link
Owner Author

kassambara commented Feb 28, 2017

Now, it's possible to display the cumulative number of censoring. Examples are provided at #155

@kassambara
Copy link
Owner Author

Symplifying test name in .get_pvalue()

method <- "Log-rank (survdiff)"

    test_name <- c("Log-rank (comp)", "Gehan-Breslow (generalized Wilcoxon)",
                   "Tarone-Ware", "Peto-Peto's modified survival estimate",
                   "modified Peto-Peto (by Andersen)", "Fleming-Harrington (p=1, q=1)")

@kassambara
Copy link
Owner Author

Suggestion:

method <- "Log-rank"

test_name <- c("Log-rank", "Gehan-Breslow",
               "Tarone-Ware", "Peto-Peto",
               "modified Peto-Peto", "Fleming-Harrington (p=1, q=1)")

kassambara added a commit that referenced this issue Mar 11, 2017
kassambara added a commit that referenced this issue Mar 11, 2017
kassambara added a commit that referenced this issue Mar 13, 2017
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

1 participant