Learn R Programming

survregVB

Overview

survregVB is an R package that provides Bayesian inference for log-logistic accelerated failure time (AFT) models used in survival analysis as a faster alternative to Markov chain Monte Carlo (MCMC) methods. The details of the Variational Bayes algorithms with and without shared frailty can be found in Xian et al., (2024a) and Xian et al., (2024b) respectively.

Installation

To install survregVB, use the following command:

remotes::install_github("https://github.com/chengqianxian/survregVB")

Usage

Loading the Package

library(survregVB)
library(survival) 

Fitting a Basic Model

# Example using dataset included in the package
data(dnase)

# Fit a survival model
fit <- survregVB(formula = Surv(time, infect) ~ trt + fev, data = dnase,
                 alpha_0 = 501, omega_0 = 500, mu_0 = c(4.4, 0.25, 0.04), v_0 = 1)

# Print summary
summary(fit)

Fitting a Model with Frailty

# Using dataset included in the package
data(simulation_frailty)

# Fit a survival model with shared frailty 
fit_frailty <- survregVB(formula = Surv(Time.15, delta.15) ~ x1 + x2, data = simulation_frailty,
                         alpha_0 = 3, omega_0 = 2, mu_0 = c(0, 0, 0), v_0 = 0.1,
                         lambda_0 = 3, eta_0 = 2, cluster = cluster)

# Print summary
summary(fit_frailty)

Copy Link

Version

Install

install.packages('survregVB')

Monthly Downloads

108

Version

0.0.2

License

MIT + file LICENSE | LGPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Alison Zhang

Last Published

June 22nd, 2025

Functions in survregVB (0.0.2)

survregVB.fit

Variational Bayesian Analysis of Survival Data Using a Log-Logistic Accelerated Failure Time Model
mu_star_cluster

Calculates parameter \(\mu^*\) of \(q^*(\beta)\) to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
omega_star

Calculates parameter \(\omega^*\) of \(q^*(b)\) to optimize the evidence based lower bound (ELBO) in survregVB.fit.
survregVB

Variational Bayesian Analysis of Survival Data Using a Log-Logistic Accelerated Failure Time Model
survregVB.frailty.fit

Variational Bayesian Analysis of Correlated Survival Data Using a Log-Logistic Accelerated Failure Time Model
simulation_nofrailty

Simulated data without shared frailty effects to model unclustered time-to-event data.
sigma_squared_star

Calculates parameter \(\sigma^{2*}_i\) of \(q^*(\gamma_i)\) for \(i=1,...,K\) clusters to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
tau_star

Calculates parameter \(\tau^*_i\) of \(q^*(\gamma_i)\) for \(i=1,...,K\) clusters to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
survregVB.object

Variational Bayes Accelererated Failure Time Survival Model Object
elbo

Calculates the variational Bayes convergence criteria, evidence lower bound (ELBO), optimized in survregVB.fit.
alpha_star

Calculates parameter \(\alpha^*\) of \(q^*(b)\) to optimize the evidence based lower bound (ELBO) in survregVB.fit and survregVB.frailty.fit.
eta_star

Calculates parameter \(\eta^*\) of \(q^*(\sigma^2_{\gamma})\) to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
lambda_star

Calculates parameter \(\lambda^*\) of \(q^*(\sigma^2_{\gamma})\) to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
mu_star

Calculates parameter \(\mu^*\) of \(q^*(\beta)\) to optimize the evidence based lower bound (ELBO) in survregVB.fit.
dnase

Subset of rhDNase from the survival package
lung_cancer

Subset of GSE102287: African American (AA) Patients
summary.survregVB

Summary for Variational Bayes log-logistic AFT models.
omega_star_cluster

Calculates parameter \(\omega^*\) of \(q^*(b)\) to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
Sigma_star

Calculates parameter \(\Sigma^*\) of \(q^*(\beta)\) to optimize the evidence based lower bound (ELBO) in survregVB.fit.
Sigma_star_cluster

Calculates parameter \(\Sigma^*\) of \(q^*(\beta)\) to optimize the evidence based lower bound (ELBO) in survregVB.frailty.fit.
elbo_cluster

Calculates the variational Bayes convergence criteria, evidence lower bound (ELBO), optimized in survregVB.frailty.fit.
simulation_frailty

Simulated data incorporating shared frailty effects to model clustered time-to-event data.