Title: | Incorporate Expert Opinion with Parametric Survival Models |
---|---|
Description: | Enables users to incorporate expert opinion with parametric survival analysis using a Bayesian or frequentist approach. Expert Opinion can be provided on the survival probabilities at certain time-point(s) or for the difference in mean survival between two treatment arms. Please reference it's use as Cooney, P., White, A. (2023) <doi:10.1177/0272989X221150212>. |
Authors: | Philip Cooney [aut, cre]
|
Maintainer: | Philip Cooney <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.4.0 |
Built: | 2025-02-20 19:23:18 UTC |
Source: | CRAN |
Contains functions to include expert opinion with the parametric models commonly
used in health economic modelling. Theoretical details are described elsewhere (Cooney and White 2023). Borrows many functions from the survHE
package (Baio 2020) and flexsurv
package (Jackson 2016).
Package: | expertsurv |
Type: | Package |
Version: | 1.4.0 |
Date: | 2023-09-22 |
License: | MIT + file LICENSE |
LazyLoad: | yes |
Integrate expert opinions on survival and mean differences in survival with common parametric survival models using either a Bayesian or frequentist framework.
Philip Cooney Package Creator, Maintainer
Arthur White Thesis Supervisor
P Cooney (2023). expertsurv: Incorporating expert opinion into parametric survival models.
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14. Cooney P, White A (2023). “Direct Incorporation of Expert Opinion into Parametric Survival Models to Inform Survival Extrapolation.” Medical Decision Making, 1(1), 0272989X221150212. doi:10.1177/0272989X221150212, PMID: 36647200, https://doi.org/10.1177/0272989X221150212, https://doi.org/10.1177/0272989X221150212. Jackson C (2016). “flexsurv: A Platform for Parametric Survival Modeling in R.” Journal of Statistical Software, 70(8), 1–33. doi:10.18637/jss.v070.i08.
#Define expert opinion require("dplyr") param_expert_example1 <- list() #1 timepoint and 2 experts with equal weight, #first a normal distribution, second a non-standard t-distribution with #3 degrees of freedom 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.05,0.05), 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 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) #Visualize the goodness of fit model.fit.plot(example1, type = "aic") #Visualize the survival curve plot(example1, add.km = TRUE, t = 0:30)
#Define expert opinion require("dplyr") param_expert_example1 <- list() #1 timepoint and 2 experts with equal weight, #first a normal distribution, second a non-standard t-distribution with #3 degrees of freedom 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.05,0.05), 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 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) #Visualize the goodness of fit model.fit.plot(example1, type = "aic") #Visualize the survival curve plot(example1, add.km = TRUE, t = 0:30)
Survival times of 686 patients with primary node positive breast cancer. See flexsurv for details.
bc
bc
An object of class data.frame
with 686 rows and 4 columns.
See flexsurv
for details.
A data frame containing a sequence of observed or censored transitions to the next stage of severity or death. It is grouped by patient and includes histories of 204 patients. All patients start in state 1 (no BOS) at six months after transplant, and may subsequently develop BOS or die.
Papworth Hospital, U.K.
Heng. D. et al. (1998). Bronchiolitis Obliterans Syndrome: Incidence, Natural History, Prognosis, and Risk Factors. Journal of Heart and Lung Transplantation 17(12)1255–1263.
The compile_stan
function pre-compiles specified Stan models used in the expertsurv
package for Bayesian survival analysis. By compiling the models ahead of time, you can significantly reduce computation time during model fitting, as the models won't need to be compiled each time they're used.
compile_stan(dist_stan = c("exp", "wei", "wph", "rps", "llo", "lno"))
compile_stan(dist_stan = c("exp", "wei", "wph", "rps", "llo", "lno"))
dist_stan |
A character vector specifying the distributions to compile. Options include:
Defaults to |
Pre-compiling Stan models is recommended when working with Bayesian methods in survival analysis, as it avoids the overhead of compiling models during each function call. This is particularly beneficial when running multiple models or iterations.
The function internally calls rstan::stan_model()
for each specified distribution, compiling the Stan code associated with that model.
A named list of compiled Stan models corresponding to the specified distributions.
library(dplyr) # Prepare the data # Assume 'data' is your dataset containing 'time' and 'censored' variables data2 <- data %>% rename(status = censored) %>% mutate( time2 = ifelse(time > 10, 10, time), status2 = ifelse(time > 10, 0, status) ) # Pre-compile Stan models (ideally after installing the package) # This step can be time-consuming but only needs to be done once per session compiled_models_saved <- compile_stan() # Fit the survival models using Bayesian methods example1 <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), # Weibull and Gompertz distributions method = "bayes", compile_mods = compiled_models_saved) # Examine the results summary(example1) plot(example1)
library(dplyr) # Prepare the data # Assume 'data' is your dataset containing 'time' and 'censored' variables data2 <- data %>% rename(status = censored) %>% mutate( time2 = ifelse(time > 10, 10, time), status2 = ifelse(time > 10, 0, status) ) # Pre-compile Stan models (ideally after installing the package) # This step can be time-consuming but only needs to be done once per session compiled_models_saved <- compile_stan() # Fit the survival models using Bayesian methods example1 <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), # Weibull and Gompertz distributions method = "bayes", compile_mods = compiled_models_saved) # Examine the results summary(example1) plot(example1)
Pre-compiled stan models that can be generated by the compile_stan function. These compiled stan models can be supplied to the fit.models.expert
function with the argument compile_mods
. This greatly facilitates the estimation of the parametric survival models run by stan.
Generated from compile_stan
Returns the interval based on defined quantiles. The approach used only provides an approximate (although quite accurate) integral.
cred_int(plt_obj, val = "linear pool", interval = c(0.025, 0.975))
cred_int(plt_obj, val = "linear pool", interval = c(0.025, 0.975))
plt_obj |
A plot object from |
val |
The name of the opinion for which the interval will be generated. |
interval |
A vector of the upper and lower probabilities. Default is the standard 95% interval |
Credible interval based on the pooled distribution
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.005,0.005), param3 = c(NA,3)) plot_opinion1<- plot_expert_opinion(param_expert_example1[[1]], weights = param_expert_example1[[1]]$wi) cred_int(plot_opinion1,val = "linear pool", interval = c(0.025, 0.975))
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.005,0.005), param3 = c(NA,3)) plot_opinion1<- plot_expert_opinion(param_expert_example1[[1]], weights = param_expert_example1[[1]]$wi) cred_int(plot_opinion1,val = "linear pool", interval = c(0.025, 0.975))
A dataset containing fictional data from a trial, where the main outcome is in terms of time-to-event and censoring indicator and with additional covariates.
data
data
An object of class data.frame
with 367 rows and 8 columns.
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
Opens up a web browser (using the shiny package), from which you can specify judgements and fit distributions for multiple timepoints and experts. Plots of the fitted density functions are provided overlayed on the survival data (where appropriate).
elicit_surv(compile_mods = NULL)
elicit_surv(compile_mods = NULL)
compile_mods |
list of compiled stan models generated by compile_stan. Supplying the compiled stan models will greatly speed up the computation of the Bayesian analysis (otherwise each time a stan model is run it will be compiled (and not reused between runs)). |
Once the elicitation is complete the analysis can be run.
Click "Download R objects" to download the expertsurv
object generated from the analysis.
Click "Download report" to generate a report including plots and parameter values for the parametric survival models.
For detailed instructions use browseVignettes("expertsurv")
If "Download R objects" selected an expertsurv
object containing the results of the elicitation and analysis. The object includes:
model
: The fitted survival models.
parameters
: The estimated parameters for each model.
If "Download report" selected either .html, .pdf or .docx document is downloaded with:
plot
: Plots of the fitted survival overlayed on the Kaplan Meier data and plot of expert opinion as probability distributions.
summary
: A summary report of the analysis including goodness of fit and parameter values.
Philip Cooney [email protected]
if (interactive()) { elicit_surv() }
if (interactive()) { elicit_surv() }
The fit.models.expert
function extends the capabilities of the survHE
package by allowing users to fit parametric survival models that incorporate expert opinion. Expert opinions can be on survival probabilities at specific time points or on expected differences in survival between groups. This function is particularly useful when empirical data is scarce or incomplete, and expert knowledge can help inform the analysis.
fit.models.expert( formula = NULL, data, distr = NULL, method = "bayes", opinion_type = "survival", param_expert = NULL, ... )
fit.models.expert( formula = NULL, data, distr = NULL, method = "bayes", opinion_type = "survival", param_expert = NULL, ... )
formula |
An object of class |
data |
A data frame containing the variables specified in the |
distr |
A character vector specifying the distribution(s) to be used for the survival model(s), as per
Note: The Generalized F model is not available when |
method |
The estimation method to be used. Options are:
Note: The |
opinion_type |
A character string specifying the type of expert opinion provided:
|
param_expert |
A list where each element corresponds to a time point (if applicable) and contains a data frame of expert opinions. Each data frame should have the following columns, with each row representing an expert:
|
... |
Other arguments required depending on the analysis. Important ones include:
|
This function enables the integration of expert opinion into parametric survival models. Expert opinion can be particularly valuable when data is limited or censored, as it allows for informed estimates of survival functions or differences between treatment groups.
The function supports both Maximum Likelihood Estimation (MLE) and Bayesian methods. For Bayesian estimation, models are fitted using Stan or JAGS, depending on the distribution. Pre-compiling Stan models using compile_stan
is highly recommended to reduce computation time.
An object of class expertsurv
containing the fitted models, parameter estimates, and other relevant information. This object can be used with plotting and summary functions for further analysis.
## Not run: library(dplyr) # Example 1: Incorporating Expert Opinion on Survival Probabilities Using MLE # Define expert opinion as a normal distribution centered at 0.1 with sd 0.05 param_expert_example1 <- list() param_expert_example1[[1]] <- data.frame( dist = "norm", wi = 1, # Ensure weights sum to 1 across experts param1 = 0.1, param2 = 0.05, param3 = NA ) # Time point at which expert opinion is provided timepoint_expert <- 14 # For example, 14 months # Prepare the data # Assume 'data' is your dataset containing 'time' and 'censored' variables data2 <- data %>% rename(status = censored) %>% mutate( time2 = ifelse(time > 10, 10, time), status2 = ifelse(time > 10, 0, status) ) # Fit the survival models using MLE, incorporating expert opinion example1 <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), # Weibull and Gompertz distributions method = "mle", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1 ) # Plot the fitted survival curves along with the Kaplan-Meier estimate plot(example1, add.km = TRUE, t = 0:20) # Compare models using Akaike Information Criterion (AIC) model.fit.plot(example1, type = "aic") # Example 2: Incorporating Expert Opinion Using Bayesian Estimation # Pre-compile Stan models (ideally after installing the package) # This step can be time-consuming but only needs to be done once per session compiled_models_saved <- compile_stan() # Fit the survival models using Bayesian estimation with expert opinion example1_bayes <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), method = "bayes", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1, iter = 2000, # Set to a high number for convergence (e.g., 2000 or more) compile_mods = compiled_models_saved ) # Summarize the Bayesian model results summary(example1_bayes) # Plot the Bayesian fitted survival curves plot(example1_bayes, add.km = TRUE, t = 0:20) ## End(Not run)
## Not run: library(dplyr) # Example 1: Incorporating Expert Opinion on Survival Probabilities Using MLE # Define expert opinion as a normal distribution centered at 0.1 with sd 0.05 param_expert_example1 <- list() param_expert_example1[[1]] <- data.frame( dist = "norm", wi = 1, # Ensure weights sum to 1 across experts param1 = 0.1, param2 = 0.05, param3 = NA ) # Time point at which expert opinion is provided timepoint_expert <- 14 # For example, 14 months # Prepare the data # Assume 'data' is your dataset containing 'time' and 'censored' variables data2 <- data %>% rename(status = censored) %>% mutate( time2 = ifelse(time > 10, 10, time), status2 = ifelse(time > 10, 0, status) ) # Fit the survival models using MLE, incorporating expert opinion example1 <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), # Weibull and Gompertz distributions method = "mle", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1 ) # Plot the fitted survival curves along with the Kaplan-Meier estimate plot(example1, add.km = TRUE, t = 0:20) # Compare models using Akaike Information Criterion (AIC) model.fit.plot(example1, type = "aic") # Example 2: Incorporating Expert Opinion Using Bayesian Estimation # Pre-compile Stan models (ideally after installing the package) # This step can be time-consuming but only needs to be done once per session compiled_models_saved <- compile_stan() # Fit the survival models using Bayesian estimation with expert opinion example1_bayes <- fit.models.expert( formula = Surv(time2, status2) ~ 1, data = data2, distr = c("wei", "gom"), method = "bayes", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1, iter = 2000, # Set to a high number for convergence (e.g., 2000 or more) compile_mods = compiled_models_saved ) # Summarize the Bayesian model results summary(example1_bayes) # Plot the Bayesian fitted survival curves plot(example1_bayes, add.km = TRUE, t = 0:20) ## End(Not run)
Creates the survival curves for the fitted model(s) - Original code from survHE
make.surv(fit, mod = 1, t = NULL, newdata = NULL, nsim = 1, ...)
make.surv(fit, mod = 1, t = NULL, newdata = NULL, nsim = 1, ...)
fit |
the result of the call to the |
mod |
the index of the model. Default value is 1, but the user can choose which model fit to visualise, if the call to fit.models has a vector argument for distr (so many models are fitted & stored in the same object) |
t |
the time vector to be used for the estimation of the survival curve |
newdata |
a list (of lists), specifiying the values of the covariates
at which the computation is performed. For example
|
nsim |
The number of simulations from the distribution of the survival
curves. Default at |
... |
Additional options |
A list with survival times for the fitted models
Gianluca Baio
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
psa.plot
(for example)
Plots a summary of the model fit for all the models fitted.
model.fit.plot(..., type = "dic")
model.fit.plot(..., type = "dic")
... |
Optional inputs. Must include an |
type |
should the DIC, WAIC, PML be plotted (AIC, BIC also allowed but only valid for frequentist approach). |
A plot with the relevant model fitting statistics plotted in order of fit.
require("dplyr") param_expert_example1 <- list() param_expert_example1[[1]] <- data.frame(dist = c("norm"), wi = c(1), # Ensure Weights sum to 1 param1 = c(0.1), param2 = c(0.05), param3 = c(NA)) timepoint_expert <- 14 # Expert opinion at t = 14 data2 <- expertsurv::data %>% rename(status = censored) %>% mutate(time2 = ifelse(time > 10, 10, time), status2 = ifelse(time> 10, 0, status)) example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wei", "gomp"), method="mle", pool_type = "linear pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) model.fit.plot(example1, type = "aic")
require("dplyr") param_expert_example1 <- list() param_expert_example1[[1]] <- data.frame(dist = c("norm"), wi = c(1), # Ensure Weights sum to 1 param1 = c(0.1), param2 = c(0.05), param3 = c(NA)) timepoint_expert <- 14 # Expert opinion at t = 14 data2 <- expertsurv::data %>% rename(status = censored) %>% mutate(time2 = ifelse(time > 10, 10, time), status2 = ifelse(time> 10, 0, status)) example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wei", "gomp"), method="mle", pool_type = "linear pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) model.fit.plot(example1, type = "aic")
Returns a ggplot with the individual expert opinions along with the pooled distributions (both linear and logarithmic).
plot_expert_opinion( object, xl_plt = NULL, xu_plt = NULL, weights = NULL, St_indic = 0 )
plot_expert_opinion( object, xl_plt = NULL, xu_plt = NULL, weights = NULL, St_indic = 0 )
object |
Either a object of class elicitation (from |
xl_plt |
Optionally set the lower bound for the plot |
xu_plt |
Optionally set the upper bound for the plot |
weights |
A vector with the weight of each expert. If omitted, set to equal weights. |
St_indic |
Set to 1 if you want to truncate the distributions to be between 0 and 1. |
A ggplot with pooled distributions.
expert_df <- data.frame(dist = c("norm","t"), #Distribution Name wi = c(1/3,2/3), #Expert weights param1 = c(0.3,0.40), #Parameter 1 param2 = c(0.05,0.05),# Parameter 2 param3 = c(NA,3)) #Parameter 3: Only t-distribution plot_expert_opinion(expert_df , weights = expert_df$wi)
expert_df <- data.frame(dist = c("norm","t"), #Distribution Name wi = c(1/3,2/3), #Expert weights param1 = c(0.3,0.40), #Parameter 1 param2 = c(0.05,0.05),# Parameter 2 param3 = c(NA,3)) #Parameter 3: Only t-distribution plot_expert_opinion(expert_df , weights = expert_df$wi)
fit.models
Plot survival curves for the models fitted using fit.models
## S3 method for class 'expertsurv' plot(...)
## 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 G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
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) plot(example1_mle, add.km = TRUE, t = 0:30,plot_opinion = TRUE)
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) plot(example1_mle, add.km = TRUE, t = 0:30,plot_opinion = TRUE)
fit.models
Prints the summary table for the model(s) fitted, with the estimate of the
parameters - ported from survHE
.
## S3 method for class 'expertsurv' print(x, mod = 1, ...)
## S3 method for class 'expertsurv' print(x, mod = 1, ...)
x |
the |
mod |
is the index of the model. Default value is 1, but the user can choose which model fit to visualise, if the call to fit.models has a vector argument for distr (so many models are fitted & stored in the same object) |
... |
additional options, including: |
Printed message (no object returned) providing estimates of the survival models.
Gianluca Baio
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
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)) mle = example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) print(mle)
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)) mle = example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) print(mle)
survHE
Plots the survival curves for all the PSA simulations. The function is
actually deprecated - similar graphs can be obtained directly using
the plot
method (with options), which allows a finer depiction
of the results.
psa.plot(psa, ...)
psa.plot(psa, ...)
psa |
the result of the call to the function |
... |
Optional graphical parameters, such as: |
ggplot2 object of the survival curve including parameter uncertainty
Gianluca Baio
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
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 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) p.mle = make.surv(example1,mod= 2,t = 1:30, nsim=1000) #Plot the Gompertz model psa.plot(p.mle , name_labs = "PSA", labs = "Gompertz", col ="blue")
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 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle", pool_type = "log pool", opinion_type = "survival", times_expert = timepoint_expert, param_expert = param_expert_example1) p.mle = make.surv(example1,mod= 2,t = 1:30, nsim=1000) #Plot the Gompertz model psa.plot(p.mle , name_labs = "PSA", labs = "Gompertz", col ="blue")
Calculates the mean survival time as the area under the survival curve -
ported from survHE
## S3 method for class 'expertsurv' summary(object, mod = 1, t = NULL, nsim = 1000, ...)
## S3 method for class 'expertsurv' summary(object, mod = 1, t = NULL, nsim = 1000, ...)
object |
a |
mod |
the model to be analysed (default = 1) |
t |
the vector of times to be used in the computation. Default = NULL, which means the observed times will be used. NB: the vector of times should be: i) long enough so that S(t) goes to 0; and ii) dense enough so that the approximation to the AUC is sufficiently precise |
nsim |
the number of simulations from the survival curve distributions to be used (to compute interval estimates) |
... |
Additional options |
A list comprising of the following elements:
mean.surv |
A matrix with the simulated values for the mean survival times |
tab |
A summary table |
Gianluca Baio
Baio G (2020). “survHE: Survival Analysis for Health Economic Evaluation and Cost-Effectiveness Modeling.” Journal of Statistical Software, 95(14), 1–47. doi:10.18637/jss.v095.i14.
require("dplyr") data2 <- data %>% rename(status = censored) %>% mutate(time2 = ifelse(time > 10, 10, time), status2 = ifelse(time> 10, 0, status)) mle = example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle") summary(mle)
require("dplyr") data2 <- data %>% rename(status = censored) %>% mutate(time2 = ifelse(time > 10, 10, time), status2 = ifelse(time> 10, 0, status)) mle = example1 <- fit.models.expert(formula=Surv(time2,status2)~1,data=data2, distr=c("wph", "gomp"), method="mle") summary(mle)