fit.coxmodel | R Documentation |
Fit a Cox model (possibly with some linear adjustments) and return key statistics about the fit.
fit.coxmodel( groups, survobj, stages = NA, rounding = 3, other.data = NULL, data.type.ordinal = FALSE )
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 |
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
Syed Haider & Paul C. Boutros
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 );
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.