View source: R/plot.expertsurv.R
plot.expertsurv | R Documentation |
fit.models
Plots the results of model fit.
## S3 method for class 'expertsurv'
plot(...)
... |
Must include at least one result object saved as
the call to the |
A ggplot2 object of the survival curves.
Gianluca Baio
Baio.2020expertsurv
fit.models
, write.surv
require("dplyr")
param_expert_example1 <- list()
param_expert_example1[[1]] <- data.frame(dist = c("norm","t"),
wi = c(0.5,0.5), # Ensure Weights sum to 1
param1 = c(0.1,0.12),
param2 = c(0.15,0.5),
param3 = c(NA,3))
timepoint_expert <- 14
data2 <- data %>% rename(status = censored) %>% mutate(time2 = ifelse(time > 10, 10, time),
status2 = ifelse(time> 10, 0, status))
example1_mle <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2,
distr=c("wph", "exp"),
method="mle",
pool_type = "log pool",
opinion_type = "survival",
times_expert = timepoint_expert,
param_expert = param_expert_example1)
#Warning! 50 iterations is far too few, however, it has been done so that the
#example can be run for CRAN
example1_bayes <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2,
distr=c("wph", "exp"),
method="hmc",
iter = 50,
pool_type = "log pool",
opinion_type = "survival",
times_expert = timepoint_expert,
param_expert = param_expert_example1)
plot(MLE=example1_mle,Bayesian=example1_bayes, add.km = TRUE, t = 0:30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.