fit.coxmodel: Fit a Cox proportional hazards model

View source: R/fit.coxmodel.R

fit.coxmodelR Documentation

Fit a Cox proportional hazards model

Description

Fit a Cox model (possibly with some linear adjustments) and return key statistics about the fit.

Usage

fit.coxmodel(
  groups,
  survobj,
  stages = NA,
  rounding = 3,
  other.data = NULL,
  data.type.ordinal = FALSE
)

Arguments

groups

Grouping of patients (passed directly to coxph, so factors & continuous variables are okay)

survobj

An object of class Surv (from the survival package) – patient ordering needs to be identical as for groups

stages

DEPRECATED! Use other.data instead.

rounding

How many digits of precision should be returned?

other.data

A data-frame (or matrix?) of variables to be controlled in the Cox model. If null, no adjustment is done. No interactions are fit.

data.type.ordinal

Logical indicating whether to treat this datatype as ordinal. Defaults to FALSE

Value

A list containing two elements. cox.stats containing a vector or matrix: HR, lower 95% CI of HR, upper 95% CI of HR, P-value (for groups), number of samples (total with group assignments, although some may not be included in fit for other reasons so this is an upper-limit). cox.obj containing coxph model object

Author(s)

Syed Haider & Paul C. Boutros

Examples


survtime <- sample(seq(0.1,10,0.1), 100, replace = TRUE);
survstat <- sample(c(0,1), 100, replace = TRUE);
survobj <- Surv(survtime, survstat);
groups <- sample(c('A','B'), 100, replace = TRUE);
fit.coxmodel(
  groups = as.factor(groups),
  survobj = survobj
  );


SIMMS documentation built on April 24, 2022, 5:06 p.m.