dot-do_coxph_univ: Univariable Cox Proportional Hazards Regression Helper

.do_coxph_univR Documentation

Univariable Cox Proportional Hazards Regression Helper

Description

A helper function to perform univariable Cox proportional hazards regression and extract results in a presentation-ready format.

Usage

.do_coxph_univ(
  data,
  formula,
  format = "html",
  conf_level = 0.95,
  exponentiate = TRUE,
  include_last_row = TRUE,
  test = "LRT"
)

Arguments

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 "html".

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 TRUE.

include_last_row

Logical; if TRUE, adds a blank row at the end for spacing. Default is TRUE.

test

Type of overall test to perform Likelihood ratio test ("LRT"), Wald test ("Wald"), Score (logrank) test ("Score").

Value

A tibble with the univariable Cox regression results for the specified predictor.

Examples

## 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)

emilelatour/latable documentation built on Nov. 25, 2024, 4:58 a.m.