ddsjoberg / dcurves

Decision Curve Analysis
http://www.danieldsjoberg.com/dcurves/
Other
37 stars 14 forks source link

survival endpoints in case-control setting #14

Closed barentroia closed 1 year ago

barentroia commented 2 years ago

Hi Daniel,

thanks for this great package!

I am wondering if it is possible to generate decision curves for survival outcomes in nested case control designs.

The prevalence adjustment works for binary outcomes, but it doesn't seem to work for survival outcomes, as the plots are the same regardless of the value assigned to the prevalence input parameter (see code below).

Is this not implemented yet, or am I making some mistake in the code?

Thanks! Barbara

Binary example without and with prevalence adjustment

# Binary outcome WITHOUT prevalence adjustment
dca(cancer ~ cancerpredmarker, 
      data = df_binary,
      thresholds = seq(0, 0.35, by = 0.01),
      label = list(cancerpredmarker = "Prediction Model")) %>%
    as_tibble(x) %>%
    dplyr::filter(!is.na(net_benefit)) %>%
  ggplot(aes(x = threshold, y = net_benefit, color = label)) +
  stat_smooth(method = "loess", se = FALSE, formula = "y ~ x", 
              span = 0.2) +
  coord_cartesian(ylim = c(-0.014, 0.25)) +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(x = "Threshold Probability", y = "Net Benefit", color = "") +
  theme_bw()

# Binary outcome WITH prevalence adjustment
dca(cancer ~ cancerpredmarker, 
    data = df_binary,
    thresholds = seq(0, 0.35, by = 0.01),
    label = list(cancerpredmarker = "Prediction Model"),prevalence = 0.05) %>%
  as_tibble(x) %>%
  dplyr::filter(!is.na(net_benefit)) %>%
  ggplot(aes(x = threshold, y = net_benefit, color = label)) +
  stat_smooth(method = "loess", se = FALSE, formula = "y ~ x", 
              span = 0.2) +
  coord_cartesian(ylim = c(-0.014, 0.25)) +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(x = "Threshold Probability", y = "Net Benefit", color = "") +
  theme_bw()

Survival outcome without and with prevalence adjustment

# Survival outcome WITHOUT prevalence adjustment
dca(Surv(ttcancer, cancer) ~ cancerpredmarker, 
    data = dcurves::df_surv, 
    time = 1,
    thresholds = seq(0, 0.35, by = 0.01),
    label = list(cancerpredmarker = "Prediction Model"))  %>%
  as_tibble(x) %>%
  dplyr::filter(!is.na(net_benefit)) %>%
  ggplot(aes(x = threshold, y = net_benefit, color = label)) +
  stat_smooth(method = "loess", se = FALSE, formula = "y ~ x", 
              span = 0.2) +
  coord_cartesian(ylim = c(-0.014,0.25
  )) +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(x = "Threshold Probability", y = "Net Benefit", color = "") +
  theme_bw()

# Survival outcome WITH prevalence adjustment
dca(Surv(ttcancer, cancer) ~ cancerpredmarker, 
    data = dcurves::df_surv, 
    time = 1,
    thresholds = seq(0, 0.35, by = 0.01),
    label = list(cancerpredmarker = "Prediction Model"),prevalence=0.05)  %>%
  as_tibble(x) %>%
  dplyr::filter(!is.na(net_benefit)) %>%
  ggplot(aes(x = threshold, y = net_benefit, color = label)) +
  stat_smooth(method = "loess", se = FALSE, formula = "y ~ x", 
              span = 0.2) +
  coord_cartesian(ylim = c(-0.014,0.25
  )) +
  scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(x = "Threshold Probability", y = "Net Benefit", color = "") +
  theme_bw()
ddsjoberg commented 2 years ago

Hello! Sorry, I must have missed the post when you originally wrote it!

I'll need to review the details and get back to you.

ddsjoberg commented 2 years ago

Do you have a matched case-control design? Any rules about the entry into the cohort with respect to the amount of followup time?

barentroia commented 2 years ago

Hi, no worries! Thanks for getting back to this.

I have a nested case-control design, where controls were sampled based on incidence density sampling, and a categorical matching variable.

ddsjoberg commented 2 years ago

@barentroia i've never used incidence density sampling, but isn't there a matching component to it? If so, would you not be using the matched groups in a model with a binary endpoint (case vs control).

Pfeiffer, Ruth M, and Mitchell H Gail. (2020) “Estimating the Decision Curve and Its Precision from Three Study Designs.” Biometrical Journal 62 (3): 764–76.

If I am totally off-base here, can you send a link to a methods paper outlining the case/control selection procedure and the recommended way to analyze that data?

ddsjoberg commented 1 year ago

Feel free to re-open if you would like to continue the conversation