nt_simple_cox: Simple Cox Regression

View source: R/cox_regression.R

nt_simple_coxR Documentation

Simple Cox Regression

Description

Performing simple Cox regression.

Usage

nt_simple_cox(
  data,
  time,
  status,
  ...,
  cluster = FALSE,
  strata = NULL,
  exponentiate = TRUE,
  ci_type = "wald",
  contrast_qt = "one-unit",
  user_contrast = NULL,
  table_reference = TRUE,
  format = TRUE,
  labels = NULL,
  digits = 2,
  digits_p = 3,
  save = FALSE,
  file = "simple_cox"
)

Arguments

data

a data frame with the variables.

time

a numeric vector with the follow-up time.

status

a numeric vector indicating status, 0 = censored, 1 = event at time.

...

character values indicating confounding variables.

cluster

a character vector containing the cluster variable.

strata

a character vector containing the strata variable.

exponentiate

a logical value indicating whether coeficients should be exponentiated.

ci_type

a character value indicating the procedure to calculate confidence intervals: likelihood ratio (lr) or wald (wald).

contrast_qt

a character value quartiles, one-unit, user to indicate the contrast for all covariates.

user_contrast

a variable named list of numerical vectors indicating contrast for a given covariate.

table_reference

a logical value indicating whether the output should be presented with a line indicating the reference category.

format

a logical value indicating whether the output should be formatted.

labels

a list of labels with components given by their variable names.

digits

a numerical value defining of digits to present the results.

digits_p

a numerical value defining number of digits to present the p-values.

save

a logical value indicating whether the output should be saved as a csv file.

file

a character indicating the name of output file in csv format to be saved.

Examples

library(survival)
library(dplyr)
data(ovarian)

ovarian_nt <- ovarian |> mutate(resid.ds = factor(resid.ds,
                                                  levels = 1:2,
                                                  labels = c("no", "yes")),
                             ecog.ps = factor(ecog.ps,
                                              levels = 1:2,
                                              labels = c("I", "II")),
                             rx =factor(rx,
                                         levels = 1:2,
                                         labels = c("t1", "t2")))
ovarian_nt |> nt_simple_cox(time = futime, status = fustat,
                            labels = list(resid.ds = "Residual Disease",
                                          ecog.ps = "ECOG-PS",
                                          rx = "Treatment",
                                          age = "Age"))


dnzmarcio/ntimes documentation built on Feb. 5, 2025, 8:57 a.m.