First load the package data and take a look.
Next, fit the observed data with a piece-wise exponential model using INLA.
For the external model first we create some synthetic data consistent with user-defined constraints as follows.
Then fit a gompertz model to this. Require the
{survHEhmc}
package to be installed.
ext_Surv <- fit.models(formula = Surv(time, event) ~ 1,
data = data_sim,
distr = "gompertz",
method = "hmc",
priors = list(gom = list(a_alpha = 0.1,
b_alpha = 0.1)))
Lastly, we can run the blending step.
blend_interv <- list(min = 48, max = 150)
beta_params <- list(alpha = 3, beta = 3)
ble_Surv <- blendsurv(obs_Surv, ext_Surv, blend_interv, beta_params)
We can visualise all of the curves.
In the same way as above we fit two survival curves and then blend them together. In this case we use two exponential curves using the survHE package to fit them.
The next example is for an HMC and frequentist survival model using the flexsurv package directly.
obs_Surv3 <- fit.models(formula = Surv(death_t, death) ~ 1,
data = dat_FCR,
distr = "exponential",
method = "hmc")
ext_Surv3 <- flexsurv::flexsurvreg(formula = Surv(time, event) ~ 1,
data = data_sim,
dist = "gompertz")
ble_Surv3 <- blendsurv(obs_Surv3, ext_Surv3, blend_interv, beta_params)
plot(ble_Surv3)