cox_output_time_dependent_cov: Calculate cox regression and extract Hazard Ratio and pvalues...

View source: R/cox_output_time_dependent_cov.R

cox_output_time_dependent_covR Documentation

Calculate cox regression and extract Hazard Ratio and pvalues for time dependent covariate analyses

Description

This function calculates a univariate cox regression with the coxph function from the survival package if the argument vars is length 1; otherwise a multivariate cox regression is calculated. Hazard ratios and pvalues are extracted and shown in a table format. If a variable in univariate cox regression is divided in more than 2 groups the wald test statistic for overall significance is also shown.

Usage

cox_output_time_dependent_cov(
  data,
  time1,
  time2,
  status,
  vars,
  fixed.var = NULL,
  output = "table",
  modeltype = "full",
  p.thres = 0.1,
  niter = 10,
  weights = NULL
)

Arguments

data

data.frame or data.table containing survival data.

time1

the time interval from start of observation until date of event (e.g. disease progression or death) or censoring.

time2

ending time of the interval for interval censored or counting process data only. Intervals are assumed to be open on the left and closed on the right, (start, end]. For counting process data, event indicates whether an event o

status

variable specifying if event occured or data has been censored.

vars

variables tested for Influence on outcome. Defines type of cox regression: if length is 1 the output is a univariate cox regression, for length > 1 the output is a multivariate cox regression

fixed.var

specifies fixed variables to be included in the cox model.

output

Defines the output object of the function. Default is \"table\". Another possible option is \"fit\" to return a coxph object.

modeltype

character value. Allowed values include: "full" and "backwards". Specify if full model or backwards selection model should be used for multivariate cox regression.

p.thres

pvalue threshold for backwards selection model.

niter

number of iterations for backwards selection model.

weights

character variable specifying the name of the weights column. Weights have to be added to the original dataframe in order to be applied correctly.


MBender1992/emR documentation built on Feb. 18, 2025, 9:21 a.m.