stan-dev / stan-dev/bayesplot

Option to visualize event times and censoring times as dots in ppc_km_overlay()

Open
#558 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
442
Forks
93
Avg merge
3h 11m
Merged PRs (30d)
1

Description

I was presenting my work related to predictive model checking for survival models (Predictive Assessment and Comparison of Bayesian Survival Models for Cancer Recurrence) at StanCon and somebody asked me about a case where there are so few event times that the Kaplan-Meier curve is far from continuous. In this case, plotting the Kaplan-Meier curve for the observations is clumsy. A similar issue can arise if the time is discretized and there are only few different time points where events are happening, even though the number of events is high.

For these kinds of cases, I think it would be useful if ppc_km_overlay() had a binary parameter dots that could be used to plot the event times and censoring times as dots instead of plotting the Kaplan-Meier curve. The default value could still be dots = FALSE, which plots the Kaplan-Meier curve as before. There are some examples below.

When plotting the Kaplan-Meier curves for these two models, it can be a little bit unintuitive to say which one is fitting and which one is not, since you have to look at the points where the Kaplan-Meier curves fall.

Image Image

In my opinion, the dots would be a clearer visualization, because from these you can instantly tell, which model fits and which does not.

Image Image

Another nice thing about the dots is that they can indicate the exact locations where censoring is happening.

Image Image

I have already implemented this in my own fork so I can make the pull request relatively easily if this is deemed to be a wanted feature for the package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ppc_km_overlay() entry point and inspect how it currently plots Kaplan-Meier curves for event and censoring times. Add the requested optional dots behavior while preserving the default curve behavior, then verify that both visualization modes produce the intended plots.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.