# NOT RUN {
if(require("survival")) {
## compute survreg model
mod_surv <- survreg(Surv(futime, fustat) ~ factor(rx), ovarian,
dist = 'weibull')
survreg_plot(mod_surv)
## partition model and plot
tr_surv <- pmtree(mod_surv)
plot(tr_surv, terminal_panel = node_pmterminal(tr_surv, plotfun = survreg_plot,
confint = TRUE))
}
if(require("survival") & require("TH.data")) {
## Load data
data(GBSG2, package = "TH.data")
## Weibull model
bmod <- survreg(Surv(time, cens) ~ horTh, data = GBSG2, model = TRUE)
## Coefficient table
grid.newpage()
coeftable.survreg(bmod)
## partitioned model
tr <- pmtree(bmod)
## plot with specific coeftable
plot(tr, terminal_panel = node_pmterminal(tr, plotfun = survreg_plot,
confint = TRUE, coeftable = coeftable.survreg))
}
# }
Run the code above in your browser using DataCamp Workspace