iter_get_cox_res: Runs get_cox_res Over a Range of Features

Description Usage Arguments Value Examples

Description

This is a modified version of get_cox_res allowing for multiple runs of get_cox_res.

Usage

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

Arguments

in.df

Input data.frame.

endpoint

Column name of the endpoint.

endpoint.code

Column name of the endpoint status code.

features

This must be a list of features.

broom.fun

Which broom function to run on the cox regression results.

group

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

Value

List of data frames with each data frame being the output of get_cox_res.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library("survival")
endpoint <- "time"
endpoint.code <- "status"

# Run Cox Regression on List of Features
features <- list(c("age", "obstruct"),
                 c("nodes"))

iter_get_cox_res(colon, endpoint, endpoint.code, features,
                  group = "rx")

Example output

Detected multiple features. Running multivariate cox regression
Detected only one feature. Running univariate cox regression
# A tibble: 9 x 10
  iter_num group term  estimate std.error statistic  p.value conf.low conf.high
  <chr>    <chr> <chr>    <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
1 1        Obs   age      1.00    0.00460     0.568 5.70e- 1    0.994     1.01 
2 1        Obs   obst~    1.21    0.132       1.46  1.44e- 1    0.936     1.57 
3 1        Lev   age      1.00    0.00488     0.865 3.87e- 1    0.995     1.01 
4 1        Lev   obst~    1.42    0.129       2.68  7.28e- 3    1.10      1.82 
5 1        Lev+~ age      0.987   0.00519    -2.53  1.13e- 2    0.977     0.997
6 1        Lev+~ obst~    1.08    0.168       0.484 6.29e- 1    0.781     1.51 
7 2        Obs   nodes    1.11    0.0106     10.0   1.04e-23    1.09      1.14 
8 2        Lev   nodes    1.07    0.0101      6.40  1.52e-10    1.05      1.09 
9 2        Lev+~ nodes    1.11    0.0139      7.44  1.01e-13    1.08      1.14 
# ... with 1 more variable: test_type <chr>

survutils documentation built on May 2, 2019, 6:38 a.m.