| Type: | Package |
| Title: | Semiparametric Bayesian Regression for Dependent Current Status Data |
| Version: | 0.1.0 |
| Description: | Implements a semiparametric Bayesian regression framework using Bernstein polynomial baseline models for analyzing dependent current status data. The package accommodates proportional hazards (PH) and proportional odds (PO) regression models with Archimedean copulas ('Gumbel', 'Frank', and 'Clayton') to model the joint dependence structure between event and observation or censoring times. Estimation is performed using a Robust Adaptive Metropolis (RAM) Markov Chain Monte Carlo ('MCMC') algorithm. Model comparison metrics including Deviance Information Criterion ('DIC') and posterior summaries with Highest Posterior Density ('HPD') intervals and Kendall's tau are provided. Methodological details are described in Sharma and Balakrishnan (2026) <doi:10.1080/02664763.2026.2701921>. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 4.0.0) |
| Imports: | stats, graphics |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Language: | en-US |
| NeedsCompilation: | no |
| Packaged: | 2026-07-29 15:09:12 UTC; shikhar tyagi |
| Author: | Shikhar Tyagi |
| Maintainer: | Shikhar Tyagi <shikhar1093tyagi@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-07 10:40:07 UTC |
Bernstein Polynomial Basis and Evaluation Functions
Description
Evaluates Bernstein polynomial basis functions, derivatives, and monotonic cumulative baseline functions.
Usage
bernstein_basis(t, nu, m)
Arguments
t |
Numeric vector of time values. |
nu |
Positive scalar, upper bound of time domain [0, nu]. |
m |
Degree/order of Bernstein polynomial (integer >= 1). |
Value
Matrix of basis function values.
Bernstein Polynomial Derivative Basis Functions
Description
Bernstein Polynomial Derivative Basis Functions
Usage
bernstein_basis_deriv(t, nu, m)
Arguments
t |
Numeric vector of time values. |
nu |
Positive scalar, upper bound of time domain [0, nu]. |
m |
Degree/order of Bernstein polynomial (integer >= 1). |
Value
Matrix of derivative basis function values.
Evaluate Bernstein Polynomial Baseline Derivative Function
Description
Evaluate Bernstein Polynomial Baseline Derivative Function
Usage
bernstein_deriv_eval(t, nu, log_scale, z)
Arguments
t |
Numeric vector of observation times. |
nu |
Upper bound of the domain. |
log_scale |
Log scale parameter. |
z |
Unconstrained weights vector. |
Value
Vector of baseline hazard rates h_0(t) or odds derivative values o_0(t).
Evaluate Bernstein Polynomial Cumulative Baseline Function
Description
Evaluate Bernstein Polynomial Cumulative Baseline Function
Usage
bernstein_eval(t, nu, log_scale, z)
Arguments
t |
Numeric vector of observation times. |
nu |
Upper bound of the domain. |
log_scale |
Log scale parameter. |
z |
Unconstrained weights vector. |
Value
Vector of cumulative hazard/odds values H_0(t) or O_0(t).
Compute Highest Posterior Density (HPD) Interval
Description
Compute Highest Posterior Density (HPD) Interval
Usage
calc_hpd(sample, prob = 0.95)
Arguments
sample |
Numeric vector of posterior draws. |
prob |
Probability mass contained in the interval (default 0.95). |
Value
Named vector with lower and upper HPD bounds.
Copula Functions for Dependent Current Status Models
Description
Evaluate Archimedean copula CDFs, partial derivatives, and Kendall's tau.
Usage
copula_cdf(u, v, alpha, copula = c("gumbel", "frank", "clayton"), eps = 1e-10)
Arguments
u |
Numeric vector or matrix of values in (0, 1). |
v |
Numeric vector or matrix of values in (0, 1). |
alpha |
Copula parameter. |
copula |
Character string specifying the copula family: |
eps |
Small constant to prevent numerical underflow/overflow. |
Value
Numeric vector of copula values or partial derivatives.
Compute Kendall's Tau for Copula Families
Description
Compute Kendall's Tau for Copula Families
Usage
copula_kendall_tau(alpha, copula = c("gumbel", "frank", "clayton"))
Arguments
alpha |
Copula parameter. |
copula |
Character string specifying the copula family. |
Value
Numeric value of Kendall's tau correlation coefficient.
Examples
copula_kendall_tau(2.0, "gumbel")
copula_kendall_tau(1.5, "clayton")
copula_kendall_tau(3.0, "frank")
Partial Derivative of Copula with respect to Second Variable
Description
Evaluates m_alpha(u, v) = d/dv C_alpha(u, v) for Archimedean copulas.
Usage
copula_m_alpha(
u,
v,
alpha,
copula = c("gumbel", "frank", "clayton"),
eps = 1e-10
)
Arguments
u |
Numeric vector or matrix of values in (0, 1). |
v |
Numeric vector or matrix of values in (0, 1). |
alpha |
Copula parameter. |
copula |
Character string specifying the copula family: |
eps |
Small constant to prevent numerical underflow/overflow. |
Value
Numeric vector of conditional probabilities P(U <= u | V = v).
Fit Semiparametric Bayesian Regression for Dependent Current Status Data
Description
Fits a semiparametric Bayesian regression model using Bernstein polynomials and Archimedean copulas for dependent current status survival data. Supports Proportional Hazards (PH) and Proportional Odds (PO) models.
Usage
fit_semiparam_bernstein_depcs(
formula_Y = NULL,
formula_T = NULL,
data = NULL,
time = NULL,
status = NULL,
delta = NULL,
X_Y = NULL,
X_T = NULL,
model_type = c("PH", "PO"),
copula = c("gumbel", "frank", "clayton"),
order_m = 2,
order_m_Y = NULL,
order_m_T = NULL,
nu_Y = NULL,
nu_T = NULL,
n_iter = 2000,
n_burn = 500,
thin = 1,
seed = NULL,
priors = NULL
)
fit_bernstein_depcs(
formula_Y = NULL,
formula_T = NULL,
data = NULL,
time = NULL,
status = NULL,
delta = NULL,
X_Y = NULL,
X_T = NULL,
model_type = c("PH", "PO"),
copula = c("gumbel", "frank", "clayton"),
order_m = 2,
order_m_Y = NULL,
order_m_T = NULL,
nu_Y = NULL,
nu_T = NULL,
n_iter = 2000,
n_burn = 500,
thin = 1,
seed = NULL,
priors = NULL
)
Arguments
formula_Y |
Formula for current status outcome and event covariates, e.g., |
formula_T |
Formula for observation time and censoring covariates, e.g., |
data |
Data frame containing variables in formulas. |
time |
Vector of observation times (if formulas not provided). |
status |
Vector of observation time censoring indicators (1 = uncensored/event for T, 0 = administrative censoring). |
delta |
Vector of current status indicators (1 = Y <= T, 0 = Y > T). |
X_Y |
Design matrix for event time Y covariates. |
X_T |
Design matrix for observation time T covariates. |
model_type |
Character string, either |
copula |
Copula family for dependence structure: |
order_m |
Order of Bernstein polynomial baseline model (default 2). |
order_m_Y |
Order of Bernstein polynomial for Y (defaults to |
order_m_T |
Order of Bernstein polynomial for T (defaults to |
nu_Y |
Upper bound of time domain for Y (defaults to |
nu_T |
Upper bound of time domain for T (defaults to |
n_iter |
Total MCMC iterations (default 2000). |
n_burn |
Burn-in iterations to discard (default 500). |
thin |
Thinning interval (default 1). |
seed |
Optional random seed. |
priors |
List of prior hyperparameters. |
Value
An object of class semiparam_bernstein_depcs containing MCMC chains, posterior summaries, DIC, log-likelihood, and model specifications.
Examples
set.seed(123)
dat <- sim_bernstein_depcs(n = 100, model_type = "PH", copula = "gumbel")
fit <- fit_semiparam_bernstein_depcs(
formula_Y = delta ~ x1 + x2,
formula_T = time ~ x1 + x2,
data = dat,
model_type = "PH",
copula = "gumbel",
order_m = 2,
n_iter = 500,
n_burn = 100
)
print(fit)
summary(fit)
Log-Likelihood and Log-Posterior Functions for Dependent Current Status Data
Description
Computes the log-likelihood and log-posterior distribution for PH and PO regression models with Bernstein polynomial baseline and Archimedean copula dependent censoring.
Usage
log_likelihood_depcs(theta, data_list, eps = 1e-10)
Arguments
theta |
Unconstrained parameter vector. |
data_list |
List containing pre-computed design matrices, response variables, and bounds:
|
eps |
Small constant to enforce strict boundaries. |
Value
Scalar log-likelihood or log-posterior value.
Log-Posterior Distribution Function
Description
Log-Posterior Distribution Function
Usage
log_posterior_depcs(theta, data_list)
Arguments
theta |
Unconstrained parameter vector. |
data_list |
List containing pre-computed design matrices, response variables, and bounds:
|
Value
Scalar log-posterior density.
Log-Prior Distribution
Description
Log-Prior Distribution
Usage
log_prior_depcs(theta, data_list)
Arguments
theta |
Unconstrained parameter vector. |
data_list |
List containing pre-computed design matrices, response variables, and bounds:
|
Value
Scalar log-prior probability.
Transform Unconstrained Parameters to Monotonic Bernstein Coefficients
Description
Transform Unconstrained Parameters to Monotonic Bernstein Coefficients
Usage
params_to_gamma(log_scale, z)
Arguments
log_scale |
Logarithm of the overall scale parameter S > 0. |
z |
Vector of unconstrained weight parameters of length m. |
Value
Vector gamma of length m + 1 with gamma_0 = 0 < gamma_1 <= ... <= gamma_m = S.
Primary Biliary Cirrhosis (PBC) Dependent Current Status Dataset
Description
A benchmark dataset containing clinical trial information from Primary Biliary Cirrhosis (PBC) patients used to analyze dependent current status data.
Usage
data(pbc_depcs)
Format
A data frame with 100 rows and 8 variables:
- time
Survival/observation time in days.
- status
Censoring indicator for survival time (1 = dead, 0 = censored).
- delta
Current status indicator for hepatomegaly onset (1 = present, 0 = absent).
- age
Patient age in years.
- sex
Patient gender (1 = male, 0 = female).
- ascites
Presence of ascites (1 = yes, 0 = no).
- bilirubin
Serum bilirubin level in mg/dl.
- albumin
Serum albumin level in g/dl.
Source
Mayo Clinic trial data on Primary Biliary Cirrhosis (PBC), adapted for dependent current status analysis in Sharma and Balakrishnan (2026) <doi:10.1080/02664763.2026.2701921>.
Plot Predicted Survival Curves or Diagnostics
Description
Plot Predicted Survival Curves or Diagnostics
Usage
## S3 method for class 'semiparam_bernstein_depcs'
plot(x, type = c("survival", "trace", "hazard"), ...)
Arguments
x |
An object of class |
type |
Character string indicating plot type: |
... |
Additional graphic parameters. |
Value
Invisible NULL.
Predict Survival and Cumulative Hazards for New Data
Description
Computes predicted marginal survival curves S_Y(t | X_new) and S_T(t | X_new) with HPD intervals.
Usage
## S3 method for class 'semiparam_bernstein_depcs'
predict(object, newdata = NULL, times = NULL, prob = 0.95, ...)
Arguments
object |
An object of class |
newdata |
Optional data frame or list containing new covariate values. If NULL, uses average covariate values. |
times |
Grid of time points to evaluate predictions. If NULL, defaults to 50 points over [0, nu]. |
prob |
Credible interval level (default 0.95). |
... |
Additional arguments. |
Value
A list containing predicted survival probabilities and HPD bounds for Y and T.
Examples
set.seed(123)
dat <- sim_bernstein_depcs(n = 100, model_type = "PH", copula = "gumbel")
fit <- fit_semiparam_bernstein_depcs(
formula_Y = delta ~ x1 + x2,
formula_T = time ~ x1 + x2,
data = dat,
n_iter = 500,
n_burn = 100
)
pred <- predict(fit, times = seq(0.1, 2, length.out = 10))
Print Summary of Fitted SemiParamBernsteinDepCS Model
Description
Print Summary of Fitted SemiParamBernsteinDepCS Model
Usage
## S3 method for class 'semiparam_bernstein_depcs'
print(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments passed to print. |
Value
Invisible x.
Robust Adaptive Metropolis (RAM) MCMC Sampler
Description
Implements Vihola (2012) Robust Adaptive Metropolis algorithm for posterior sampling.
Usage
run_ram_mcmc(
log_post_fn,
theta_init,
n_iter = 2000,
n_burn = 500,
thin = 1,
target_alpha = 0.234,
gamma = 0.6
)
Arguments
log_post_fn |
Function taking parameter vector and returning log-posterior density. |
theta_init |
Initial numeric vector of parameters. |
n_iter |
Total number of MCMC iterations. |
n_burn |
Number of burn-in iterations to discard. |
thin |
Thinning interval. |
target_alpha |
Target acceptance rate (default 0.234). |
gamma |
Diminishing adaptation exponent (default 0.6). |
Value
A list containing MCMC samples, acceptance rate, and log-posterior values.
Simulate Dependent Current Status Data
Description
Generates synthetic current status data with dependent censoring based on copula models and Weibull/Bernstein marginal distributions.
Usage
sim_bernstein_depcs(
n = 200,
model_type = c("PH", "PO"),
copula = c("gumbel", "frank", "clayton"),
alpha = NULL,
beta_Y = c(0.5, -0.3),
beta_T = c(-0.2, 0.4),
scale_Y = 1,
shape_Y = 1.5,
scale_T = 1,
shape_T = 1.2,
admin_censor = 3,
seed = NULL
)
Arguments
n |
Sample size (integer, default 200). |
model_type |
Character string, either |
copula |
Copula family: |
alpha |
Copula dependence parameter (default 2.0 for Gumbel/Clayton, 3.0 for Frank). |
beta_Y |
Numeric vector of true regression coefficients for Y (default c(0.5, -0.3)). |
beta_T |
Numeric vector of true regression coefficients for T (default c(-0.2, 0.4)). |
scale_Y |
Scale parameter for Weibull baseline Y (default 1.0). |
shape_Y |
Shape parameter for Weibull baseline Y (default 1.5). |
scale_T |
Scale parameter for Weibull baseline T (default 1.0). |
shape_T |
Shape parameter for Weibull baseline T (default 1.2). |
admin_censor |
Administrative censoring time limit (default 3.0). |
seed |
Optional random seed. |
Value
A data frame containing simulated columns: time, status, delta, x1, x2.
Examples
set.seed(42)
dat <- sim_bernstein_depcs(n = 50, model_type = "PH", copula = "gumbel")
head(dat)
Summarize Fitted SemiParamBernsteinDepCS Model
Description
Summarize Fitted SemiParamBernsteinDepCS Model
Usage
## S3 method for class 'semiparam_bernstein_depcs'
summary(object, prob = 0.95, ...)
Arguments
object |
An object of class |
prob |
Credible interval level (default 0.95). |
... |
Additional arguments. |
Value
A summary table object.
Map Unconstrained Parameter to Copula Parameter
Description
Map Unconstrained Parameter to Copula Parameter
Usage
transform_alpha(alpha_raw, copula = c("gumbel", "frank", "clayton"))
Arguments
alpha_raw |
Unconstrained numeric parameter. |
copula |
Copula family name. |
Value
Copula parameter alpha in its valid domain.
Inverse Map of Copula Parameter to Unconstrained Parameter
Description
Inverse Map of Copula Parameter to Unconstrained Parameter
Usage
untransform_alpha(alpha, copula = c("gumbel", "frank", "clayton"))
Arguments
alpha |
Copula parameter in valid domain. |
copula |
Copula family name. |
Value
Unconstrained parameter alpha_raw.