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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.