fit.models.expert: Fitting Parametric Survival models with Expert Opinion

View source: R/Helper_functions.R

fit.models.expertR Documentation

Fitting Parametric Survival models with Expert Opinion

Description

Implementation of survival models with expert opinion on the survival probabilities or expected difference in survival. Function is equivalent to the fit.models in survHE except for the inclusion of the "expert_type" and "param_expert" arguments. Worked examples can be found in the README file. Note that the default method is "hmc", however, the user may use "mle" (method "inla" is not included).

Usage

fit.models.expert(
  formula = NULL,
  data,
  distr = NULL,
  method = "hmc",
  expert_type = "survival",
  param_expert = NULL,
  ...
)

Arguments

formula

As per fit.models in survHE

data

As per fit.models in survHE

distr

As per fit.models in survHE. Note Generalized F model is not available for method = "hmc" nor Royston-Parmar available with opinion on the mean survival.

method

As per fit.models in survHE. (except for the inla method). It should be noted that a few of the models are fit using JAGS, however, for consistency we still use "hmc".

expert_type

Either "survival", which indicates expert opinion on the survival function or "mean" (actually anything that does not contain "survival") which represents a belief on difference in survival.

param_expert

A list containing a dataframe for each timepoint (if applicable). Each dataframe should have columns with the following names and each row representing an expert:

  • dist: Names of the distribution assigned to each expert which may be "norm", "t", "lnorm", "gamma", "beta".

  • wi: Weight of the expert, must sum to 1.

  • param1: First parameter of the distribution (e.g. mean for norm distribution). Parameters as per SHELF package.

  • param2: Second parameter of the distribution.

  • param3: Third parameter of the distribution (NA expect for degrees of freedom for t distribution)

...

Other arguments may be required depending on the example. See README for details.

Value

An object of class expertsurv which contains the parameters of the models estimated with expert opinion.

Examples

require("dplyr")
#Expert Opinion as a normal distribution centered on 0.1 with sd 0.005
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 <- 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",
                              opinion_type = "survival",
                              times_expert = timepoint_expert, 
                              param_expert = param_expert_example1)
                              
plot(example1, add.km = TRUE, t = seq(0:20)) #Plot Survival
model.fit.plot(example1, type = "aic")  #Plot AIC 

                              

expertsurv documentation built on Oct. 5, 2023, 5:09 p.m.