Title: | 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 for the Cox model. |
Authors: | Yongwu Shao [aut, cre, cph] |
Maintainer: | Yongwu Shao <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-11-23 06:30:55 UTC |
Source: | CRAN |
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.
ExactCox(time, status, trt, hr = 1, alternative = "two.sided", conf.int = FALSE, conf.level = 0.95)
ExactCox(time, status, trt, hr = 1, alternative = "two.sided", conf.int = FALSE, conf.level = 0.95)
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. |
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.
p.value |
the p-value of the exact test. |
conf.int |
the exact confidence interval. |
alternative |
a character string describing the alternative hypothesis. |
Yongwu Shao
Shao, Y., Ye, Z. and Zhang, Z. (2024). Exact test and exact confidence interval for the Cox model. Submitted.
## 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)
## 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)