prettyCoxph | R Documentation |
Formats the coxph (or coxphf) model outputs into a prettier display.
prettyCoxph(
input.formula,
input.d,
ref.grp = NULL,
use.firth = 1,
check.ph = FALSE,
plot.ph = TRUE,
ph.test.plot.filename = NULL,
...
)
input.formula |
a formula object, with the response on the left of a
|
input.d |
data.frame containing the variables in |
ref.grp |
a named array indicating reference group(s) for any variables in the cox model. this parameter will be ignored if not applicable, e.g. for continuous variable |
use.firth |
if set to -1, Firth's correction is applied using
|
check.ph |
if |
plot.ph |
if |
ph.test.plot.filename |
character string for filename of residual plot,
including file extension. If |
... |
additional arguments to |
The original fit call is returned, along with other useful statistics. If Firth is called, we first determine if the percentage of censored cases is large enough to use Firth.
A list with elements
output |
A character matrix showing the hazard ratio, confidence bounds,
and p-value for each coefficient. If |
fit |
The fit output call returned from |
n |
The number of observations used in the fit |
nevent |
The number of events used in the fit |
ph.test |
The rho, Chi-squared statistic, and p-value for each coefficient.
Not shown if |
used.firth |
logical; if |
Samuel Leung, Derek Chiu
library(survival)
# Base output
test1 <- list(time = c(4, 3, 1, 1, 2, 2, 3),
status = c(1, 1, 1, 0, 1, 1, 0),
x = c(0, 2, 1, 1, 1, 0, 0),
sex = c(0, 0, 0, 0, 1, 1, 1))
coxph(Surv(time, status) ~ x + strata(sex), test1)
# Pretty output
prettyCoxph(Surv(time, status) ~ x + strata(sex), test1)
# x is now a factor
test1$x <- factor(test1$x)
prettyCoxph(Surv(time, status) ~ x + strata(sex), test1)
# Releveled reference group
prettyCoxph(Surv(time, status) ~ x + strata(sex), test1, ref.grp =
setNames("2", "x"))
# Use Firth's correction
prettyCoxph(Surv(time, status) ~ x + strata(sex), test1, use.firth = -1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.