censor_gr_test: Gelman-Rubin Convergence Diagnostics for Censored Data Models

View source: R/censor_gr_test.R

censor_gr_testR Documentation

Gelman-Rubin Convergence Diagnostics for Censored Data Models

Description

Evaluates lugsail Gelman-Rubin convergence diagnostics, effective sample size, and parameter estimates for MCMC chains fitted to censored data models under various censoring schemes (right, left, interval, Type-I, Type-II, progressive, and hybrid).

Usage

censor_gr_test(
  pdf_fn,
  cdf_fn,
  surv_fn = NULL,
  data,
  start_par,
  censor_type = c("right", "left", "interval", "type1", "type2", "progressive", "hybrid"),
  status = NULL,
  censor_info = NULL,
  n_iter = 2000,
  n_chains = 3,
  burn_in = 0.5,
  scale = 0.5,
  alpha = 0.05,
  epsilon = 0.1
)

Arguments

pdf_fn

Function 'function(x, par)' returning probability density values for variable 'x' given parameters 'par'.

cdf_fn

Function 'function(x, par)' returning cumulative distribution function values.

surv_fn

Optional function 'function(x, par)' returning survival function values. If 'NULL', computed as '1 - cdf_fn(x, par)'.

data

Numeric vector or matrix of observed sample data.

start_par

Initial parameter vector.

censor_type

Character string specifying censoring scheme. Options include: "right" (Right censoring), "left" (Left censoring), "interval" (Interval censoring), "type1" (Type-I censoring), "type2" (Type-II censoring), "progressive" (Progressive Type-II censoring), or "hybrid" (Hybrid censoring).

status

Numeric vector or matrix indicating event/censoring status (e.g. 1 = observed, 0 = censored).

censor_info

Optional list specifying parameters for censoring schemes (e.g. cutoff time T_censor, number of failures r_censor, or removal pattern R_pattern).

n_iter

Integer, total number of MCMC iterations per chain (default 2000).

n_chains

Integer, number of parallel chains (default 3).

burn_in

Numeric, burn-in fraction (default 0.50).

scale

Numeric or vector, proposal scale for random walk Metropolis-Hastings (default 0.5).

alpha

Numeric, significance level (default 0.05).

epsilon

Numeric, relative volume tolerance (default 0.10).

Value

An object of class "lugsail_gr" containing Gelman-Rubin diagnostics, effective sample sizes, cutoff thresholds, parameter estimates, and MCMC samples.

References

Vats, D. and Knudson, C. (2021). Revisiting the Gelman–Rubin Diagnostic. Statistical Science, 36(4), 518–529. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/20-STS812")}.

Examples

# Example: Right-censored exponential distribution
set.seed(123)
n_obs <- 30
true_rate <- 0.5
times <- rexp(n_obs, rate = true_rate)
censor_time <- 2.0
obs_times <- pmin(times, censor_time)
status <- as.numeric(times <= censor_time)

f_exp <- function(x, rate) dexp(x, rate = rate)
F_exp <- function(x, rate) pexp(x, rate = rate)
S_exp <- function(x, rate) 1 - pexp(x, rate = rate)

fit <- censor_gr_test(pdf_fn = f_exp, cdf_fn = F_exp, surv_fn = S_exp,
                     data = obs_times, start_par = c(rate = 0.8),
                     censor_type = "right", status = status,
                     n_iter = 1000, n_chains = 3)
print(fit)

LugsailGR documentation built on Aug. 5, 2026, 9:08 a.m.