fit_surv_models: Fitting Bayesian Parametric Models with JAGS

fit_surv_modelsR Documentation

Fitting Bayesian Parametric Models with JAGS

Description

In order to compare the change-point model with other common parametric survival models using Pseudo-Marginal Likelihood (PML) and Widely Applicable Information Criterion (WAIC) we need to fit them in a Bayesian framework. Requires Just Another Gibbs Sampler (JAGS) along with the packages rjags,rstan and waic to run. The JAGS models that are produced by this function should be assessed for convergence. Additionally the chains may need to be run longer. The following models are fit (Note that the parameterization used in JAGS is not equivalent to the flexsurvreg parameterization for the Weibull, Log-Logistic and Generalized Gamma):

  • Exponential

  • Weibull

  • Log-Normal

  • Log-Logistic

  • Gompertz

  • Generalized Gamma

  • Royston-Parmar Cubic Spline (1 or 2 know)

Usage

fit_surv_models(
  df,
  max_predict = 10,
  n.iter.jags = 2000,
  n.thin.jags = NULL,
  n.burnin.jags = NULL,
  gof,
  inc_waic = T,
  t_pred = NULL
)

Arguments

df

standard dataframe for time-to-event data. Two columns required, time (to event or censoring) and status (indicating event or censoring).

max_predict

maximum survival time to be predicted from the survival models. Default is 10, however, depending on the timescale this should be changed.

Details

Number of knots for Royston-Parmar is made by assessing, and finding which model gives the lowest WAIC.

Value

A list of with the following items:

  • model.fit: A dataframe with the PML and WAIC for the seven parametric models fitted by JAGS/Stan.

  • jags.models: A list containing the posterior simulations of the 6 JAGS models (fit using the rjags function).

  • jags.surv: A list of the survival probabilities for the prespecified times from the 7 JAGS/Stan models.


Philip-Cooney/PiecewiseChangepoint documentation built on Sept. 10, 2023, 9:49 p.m.