get_cox_res: Run Cox Regression on a Single or Multiple Groups of Data

Description Usage Arguments Details Value Examples

Description

get_cox_res is a wrapper around coxph. It can run univariate or multivariate cox regression. If the group parameter is used, then cox regression is run for each group separately.

Usage

1
2
get_cox_res(in.df, endpoint, endpoint.code, features, group = NULL,
  broom.fun = c("tidy", "glance"))

Arguments

in.df

Input data.frame.

endpoint

Column name of the endpoint.

endpoint.code

Column name of the endpoint status code.

features

Vector containing the features to run cox regression on.

group

Column name containing the groups to run cox regression on. If, specified, cox regression is run separately for each group.

broom.fun

Which broom function to run on the cox regression results.

Details

The data is returned in a broom::tidy data.frame format.

Value

Cox regression results returned in a tidy data.frame format.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library("survival")
endpoint <- "time"
endpoint.code <- "status"

# Run Univariate Cox Regression on Single Feature
features <- "age"
test.df <- get_cox_res(colon, endpoint, endpoint.code, features)

# Run Univariate Cox Regression on Multiple Features
multi.features <- c("age", "obstruct")
get_cox_res(colon, endpoint, endpoint.code, multi.features)

# Run Univariate Cox Regression on Multiple Features For Each rx group
group <- "rx"
get_cox_res(colon, endpoint, endpoint.code, multi.features, group)

# Run Multivariate Cox Regression 
get_cox_res(colon, endpoint, endpoint.code, multi.features)

# Run Multivariate Cox Regression For Each rx Group
get_cox_res(colon, endpoint, endpoint.code, multi.features, group)

tinyheero/survutils documentation built on May 31, 2019, 3:36 p.m.