Package 'compareCstat'

Title: Compare C-Statistics with Bootstrapped Confidence Intervals
Description: Provides a function to compare C-statistics (concordance statistics) between two survival models using bootstrap resampling. Returns confidence intervals and a p-value for the difference in C-statistics. Useful for model evaluation and comparison.
Authors: Hairong Liu [aut], Ning Meng [aut, cre]
Maintainer: Ning Meng <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-02 07:42:38 UTC
Source: https://github.com/lemonade0924/comparecstat

Help Index


Compare C-statistics Between Two Models with Bootstrapped CIs

Description

This function compares the C-statistics of two fitted models using bootstrap resampling.

Usage

compare_c_stat(model_raw, model_ext, data, R = 1000, ci_type = "perc")

Arguments

model_raw

A fitted model (e.g., coxph) representing the base model.

model_ext

A fitted model (e.g., coxph) representing the extended model.

data

The dataset used for fitting the models.

R

Number of bootstrap replications. Default is 1000.

ci_type

Type of confidence interval to return ("perc", "norm", "basic", etc.).

Value

A data frame showing C-statistics for each model, their bootstrapped confidence intervals, and the p-value for the difference.

Examples

library(survival)
data(lung)
model1 <- coxph(Surv(time, status) ~ age, data = lung)
model2 <- coxph(Surv(time, status) ~ age + sex, data = lung)
compare_c_stat(model1, model2, data = lung, R = 500)