ezcox: Run Cox Analysis in Batch Mode

Description Usage Arguments Value Author(s) Examples

View source: R/ezcox.R

Description

Run Cox Analysis in Batch Mode

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ezcox(
  data,
  covariates,
  controls = NULL,
  time = "time",
  status = "status",
  global_method = c("likelihood", "wald", "logrank"),
  keep_models = FALSE,
  return_models = FALSE,
  model_dir = file.path(tempdir(), "ezcox"),
  verbose = TRUE,
  ...
)

Arguments

data

a data.frame containing variables, time and os status.

covariates

column names specifying variables.

controls

column names specifying controls. The names with pattern "*:|()" will be treated as interaction/combination term, please make sure all column names in data are valid R variable names.

time

column name specifying time, default is 'time'.

status

column name specifying event status, default is 'status'.

global_method

method used to obtain global p value for cox model, should be one of "likelihood", "wald", "logrank". The likelihood-ratio test, Wald test, and score logrank statistics. These three methods are asymptotically equivalent. For large enough N, they will give similar results. For small N, they may differ somewhat. The Likelihood ratio test has better behavior for small sample sizes, so it is generally preferred.

keep_models

If TRUE, keep models as local files.

return_models

default FALSE. If TRUE, return a list contains cox models.

model_dir

a path for storing model results.

verbose

if TRUE, print extra info.

...

other parameters passing to survival::coxph().

Value

a ezcox object

Author(s)

Shixiang Wang w_shixiang@163.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(survival)

# Build unvariable models
t1 <- ezcox(lung, covariates = c("age", "sex", "ph.ecog"))
t1

# Build multi-variable models
# Control variable 'age'
t2 <- ezcox(lung, covariates = c("sex", "ph.ecog"), controls = "age")
t2

# Return models
t3 <- ezcox(lung,
  covariates = c("age", "sex", "ph.ecog"),
  return_models = TRUE
)
t3
t4 <- ezcox(lung,
  covariates = c("sex", "ph.ecog"), controls = "age",
  return_models = TRUE
)
t4

ezcox documentation built on Oct. 28, 2021, 5:08 p.m.