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,
  ...,
  labels = NULL,
  increment = NULL,
  cluster = FALSE,
  strata = NULL,
  format = TRUE,
  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.

labels

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

increment

a named list indicating the magnitude of increments to calculate odds ratio for continuous covariates.

cluster

a character vector containing the cluster variable.

strata

a character vector containing the strata variable.

format

a logical value indicating whether the output should be formatted.

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 Jan. 4, 2024, 2:23 p.m.