.do_coxph_univ | R Documentation |
A helper function to perform univariable Cox proportional hazards regression and extract results in a presentation-ready format.
.do_coxph_univ(
data,
formula,
format = "html",
conf_level = 0.95,
exponentiate = TRUE,
include_last_row = TRUE,
test = "LRT"
)
data |
A tibble or data frame containing the full dataset used for modeling. |
formula |
A character string representing the model formula (e.g., "Surv(time, status) ~ age"). |
format |
Display format in case characters need escaping. Placeholder for future use. Default is |
conf_level |
The confidence level to use for confidence intervals. Must be between 0 and 1. Default is 0.95. |
exponentiate |
Logical; whether to exponentiate coefficient estimates to show hazard ratios. Default is |
include_last_row |
Logical; if |
test |
Type of overall test to perform Likelihood ratio test ("LRT"), Wald test ("Wald"), Score (logrank) test ("Score"). |
A tibble with the univariable Cox regression results for the specified predictor.
## Not run:
library(survival)
data(lung)
# Perform univariable Cox regression on a single predictor
.do_coxph_univ(data = lung, formula = "Surv(time, status) ~ age")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.