View source: R/censor_gr_test.R
| censor_gr_test | R Documentation |
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).
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
)
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:
|
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 |
n_iter |
Integer, total number of MCMC iterations per chain (default |
n_chains |
Integer, number of parallel chains (default |
burn_in |
Numeric, burn-in fraction (default |
scale |
Numeric or vector, proposal scale for random walk Metropolis-Hastings (default |
alpha |
Numeric, significance level (default |
epsilon |
Numeric, relative volume tolerance (default |
An object of class "lugsail_gr" containing Gelman-Rubin diagnostics,
effective sample sizes, cutoff thresholds, parameter estimates, and MCMC samples.
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")}.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.