View source: R/Helper_functions.R
fit.models.expert | R Documentation |
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).
fit.models.expert(
formula = NULL,
data,
distr = NULL,
method = "hmc",
expert_type = "survival",
param_expert = NULL,
...
)
formula |
As per |
data |
As per |
distr |
As per |
method |
As per |
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:
|
... |
Other arguments may be required depending on the example. See README for details. |
An object of class expertsurv
which contains the parameters of the models estimated with expert opinion.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.