ExactCox {ExactCox}R Documentation

Exact Test and exact Confidence Interval for the Cox Model

Description

Performs the exact test on whether there is a difference between two survival curves. Exact confidence interval for the hazard ratio can also be generated if treatment is the only fixed effect in the Cox model.

Usage

ExactCox(time, status, trt, hr = 1, alternative = "two.sided", conf.int = FALSE,
    conf.level = 0.95)

Arguments

time

Time of the event or censoring.

status

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

trt

a binary treatment group.

hr

the hypothesized hazard ratio.

alternative

indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less".

conf.int

logical indicating if a confidence interval for the hazard ratio should be computed (and returned).

conf.level

confidence level for the returned confidence interval. Only used if conf.int = TRUE.

Details

The exact p-value is generated based on the conditional error method. The exact confidence interval is generated by inverting the exact test. See Shao, Ye and Zhang (2024) for details.

Value

p.value

the p-value of the exact test.

conf.int

the exact confidence interval.

alternative

a character string describing the alternative hypothesis.

Author(s)

Yongwu Shao

References

Shao, Y., Ye, Z. and Zhang, Z. (2024). Exact test and exact confidence interval for the Cox model. Submitted.

Examples

## Creating example data
N = 100;
futime = rexp(N)
fustat = rbinom(N, 1, 0.2)
rx = rbinom(N, 1, 0.5)
## Calculate the exact p-value and the exact confidence interval.
ExactCox(futime, fustat, rx, hr = 1, alternative = 'less', conf.int = TRUE)

[Package ExactCox version 0.1.0 Index]