Description Usage Arguments Details Value Examples
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.
1 2 | get_cox_res(in.df, endpoint, endpoint.code, features, group = NULL,
broom.fun = c("tidy", "glance"))
|
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. |
The data is returned in a broom::tidy data.frame format.
Cox regression results returned in a tidy data.frame format.
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)
|
Detected only one feature. Running univariate cox regression
Detected multiple features. Running multivariate cox regression
term estimate std.error statistic p.value conf.low conf.high
1 age 0.9983432 0.002804002 -0.5913434 0.554290364 0.9928717 1.003845
2 obstruct 1.2677379 0.080804466 2.9359039 0.003325774 1.0820531 1.485287
test_type
1 multicox
2 multicox
Detected multiple features. Running multivariate cox regression
group term estimate std.error statistic p.value conf.low
1 Obs age 1.0026174 0.004603197 0.5678581 0.57013133 0.9936124
2 Obs obstruct 1.2123725 0.131970513 1.4592591 0.14449382 0.9360576
3 Lev age 1.0042268 0.004875449 0.8651343 0.38696506 0.9946764
4 Lev obstruct 1.4151910 0.129394314 2.6837694 0.00727973 1.0981822
5 Lev+5FU age 0.9869403 0.005186566 -2.5345800 0.01125822 0.9769584
6 Lev+5FU obstruct 1.0844978 0.167766933 0.4835103 0.62873343 0.7805940
conf.high test_type
1 1.0117040 multicox
2 1.5702528 multicox
3 1.0138689 multicox
4 1.8237097 multicox
5 0.9970242 multicox
6 1.5067186 multicox
Detected multiple features. Running multivariate cox regression
term estimate std.error statistic p.value conf.low conf.high
1 age 0.9983432 0.002804002 -0.5913434 0.554290364 0.9928717 1.003845
2 obstruct 1.2677379 0.080804466 2.9359039 0.003325774 1.0820531 1.485287
test_type
1 multicox
2 multicox
Detected multiple features. Running multivariate cox regression
group term estimate std.error statistic p.value conf.low
1 Obs age 1.0026174 0.004603197 0.5678581 0.57013133 0.9936124
2 Obs obstruct 1.2123725 0.131970513 1.4592591 0.14449382 0.9360576
3 Lev age 1.0042268 0.004875449 0.8651343 0.38696506 0.9946764
4 Lev obstruct 1.4151910 0.129394314 2.6837694 0.00727973 1.0981822
5 Lev+5FU age 0.9869403 0.005186566 -2.5345800 0.01125822 0.9769584
6 Lev+5FU obstruct 1.0844978 0.167766933 0.4835103 0.62873343 0.7805940
conf.high test_type
1 1.0117040 multicox
2 1.5702528 multicox
3 1.0138689 multicox
4 1.8237097 multicox
5 0.9970242 multicox
6 1.5067186 multicox
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.