censored
censored copied to clipboard
bag_tree() models
- [x] ipred survival
- [x] ipred time
- [ ] ipred parameters
library(ipred)
library(survival)
library(pec)
#> Loading required package: prodlim
bag_mod <- bagging(Surv(time, status) ~ age + ph.ecog, data = lung)
bag_preds <- predict(bag_mod, lung)
bag_preds[[1]]
#> Call: survfit(formula = Surv(agglsample[[j]], aggcens[[j]]) ~ 1)
#>
#> n events median 0.95LCL 0.95UCL
#> 1400 1068 345 306 363
# survival
summary(bag_preds[[1]], times = c(100, 200))
#> Call: survfit(formula = Surv(agglsample[[j]], aggcens[[j]]) ~ 1)
#>
#> time n.risk n.event survival std.err lower 95% CI upper 95% CI
#> 100 1270 130 0.907 0.00776 0.892 0.922
#> 200 976 234 0.738 0.01180 0.716 0.762
# Median survival
library(purrr)
map_dbl(bag_preds, ~ quantile(.x, probs = .5)$quantile)
#> [1] 345 350 450 345 477 345 310 207 305 177 345 310 310 348 345 301 345 288
#> [19] 177 345 301 433 305 473 353 345 477 288 305 183 345 163 181 177 177 177
#> [37] 310 301 183 345 345 163 473 177 310 183 353 345 353 305 329 455 350 473
#> [55] 363 455 310 177 363 345 201 305 329 293 345 310 310 450 350 301 455 305
#> [73] 183 305 305 337 433 345 301 353 473 337 305 305 305 337 345 450 305 163
#> [91] 455 345 301 345 353 163 345 337 345 353 473 345 345 345 177 301 337 301
#> [109] 337 201 353 305 284 310 337 183 180 310 310 284 310 177 345 163 353 301
#> [127] 305 345 183 450 363 305 450 337 337 183 363 177 337 450 163 345 183 293
#> [145] 345 305 353 337 301 473 345 477 455 305 177 310 310 177 345 345 455 305
#> [163] 310 345 345 450 345 450 345 310 345 473 345 550 305 363 177 337 305 353
#> [181] 477 550 310 293 433 450 163 473 345 433 329 180 305 345 337 353 345 345
#> [199] 433 345 345 329 455 433 455 177 433 180 345 363 477 301 345 310 293 293
#> [217] 305 183 288 450 301 337 285 285 550 201 301 363
Created on 2020-08-06 by the reprex package (v0.3.0)
Can I add arguments not already used in baguette::bag_tree()?
iped::bagging() lets you transfer arguments to rpart::rpart.control()
This issue 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.