Skip to content

Nest survival/hazard predictions for scalar eval_time for flexsurv engines#254

Merged
hfrick merged 2 commits intomainfrom
flexsurv-postprocessing
Apr 11, 2023
Merged

Nest survival/hazard predictions for scalar eval_time for flexsurv engines#254
hfrick merged 2 commits intomainfrom
flexsurv-postprocessing

Conversation

@hfrick
Copy link
Member

@hfrick hfrick commented Apr 11, 2023

Before:

library(censored)
#> Loading required package: parsnip
#> Loading required package: survival

survival_reg(engine = "flexsurv") %>%
  fit(Surv(time, status) ~ age + sex, data = lung) %>%
  predict(lung[1:3, ], type = "survival", time = 100) 
#> [snip: parsnip warning on `time` arg]
#> # A tibble: 3 × 2
#>   .time .pred_survival
#>   <dbl>          <dbl>
#> 1   100          0.803
#> 2   100          0.820
#> 3   100          0.849

Created on 2023-04-11 with reprex v2.0.2

After:

library(censored)
#> Loading required package: parsnip
#> Loading required package: survival

survival_reg(engine = "flexsurv") %>%
  fit(Surv(time, status) ~ age + sex, data = lung) %>%
  predict(lung[1:3, ], type = "survival", eval_time = 100) 
#> # A tibble: 3 × 1
#>   .pred           
#>   <list>          
#> 1 <tibble [1 × 2]>
#> 2 <tibble [1 × 2]>
#> 3 <tibble [1 × 2]>

Created on 2023-04-11 with reprex v2.0.2

@hfrick hfrick merged commit c531ded into main Apr 11, 2023
@hfrick hfrick deleted the flexsurv-postprocessing branch April 11, 2023 13:46
@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant