Type: Package
Title: Robust Likelihood Ratio Test and Confidence Intervals for the Cox Model
Version: 0.1.0
Author: Yongwu Shao [aut, cre, cph]
Maintainer: Yongwu Shao <ywshao@gmail.com>
Description: Calculate the likelihood ratio test p-value and likelihood confidence intervals for misspecified Cox models, as described in Shao and Guo (2025) <doi:10.48550/arXiv.2508.11851>.
Imports: survival
License: GPL-3
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2026-01-16 17:40:13 UTC; oldwo
Repository: CRAN
Date/Publication: 2026-01-21 20:20:08 UTC

Robust Likelihood Ratio Test and Confidence Intervals for the Cox Model

Description

Calculate the (robust) likelihood ratio test p-values and confidence intervals for the Cox model.

Usage

CoxLikelihood(time, event, X, robust = TRUE, weights = NULL, alpha = 0.05)

Arguments

time

time of the event or censoring.

event

a binary variable indicating whether the record is an event or is censored. 1 is for event, 0 is for censoring.

X

a numeric matrix specifing the dependent variables of the Cox model.

robust

specifying whether the robust p-values and confidence intervals will be calculated. Default is TRUE.

weights

weights of each observation. The default is one for each observation.

alpha

1-alpha is the confidence interval (or the target coverage) of the output confidence interval.

Details

The robust likelihood ratio test p-value is based on a scaled chi-square distribution. The robust likelihood confidence interval is generated by inverting the robust likelihood ratio test. See Shao and Guo (2026) for details.

Value

A data frame which gives the hazard ratio estimate, the robust likelihood ratio test p-values, and the robust likelihood confidence intervals.

Author(s)

Yongwu Shao

References

Shao, Yongwu, and Xu Guo. "Likelihood confidence intervals for misspecified Cox models." arXiv preprint arXiv:2508.11851 (2025).

Examples

##Create example data;
set.seed(2026);
nSubj = 100;
event = rep(1, nSubj);
X = matrix(rnorm(nSubj * 3), nSubj, 3);
time = exp(-X[,2]/2 - X[,1]^2 + X[,3]);
X = X[,-3];

## Get the robust and regular likelihood confidence intervals
CoxLikelihood(time, event, X, robust = FALSE);
CoxLikelihood(time, event, X, robust = TRUE);