Learn R Programming

adelie (version 1.0.7)

glm.cox: Creates a Cox GLM family object.

Description

A GLM family object specifies the type of model fit, provides the appropriate response object and makes sure it is represented in the right form for the model family, and allows for optional parameters such as a weight vector.

Usage

glm.cox(
  stop,
  status,
  start = -Inf,
  strata = NULL,
  weights = NULL,
  tie_method = c("efron", "breslow")
)

Value

Cox GLM object.

Arguments

stop

Stop time vector.

status

Binary status vector of same length as stop, with 1 a "death", and 0 censored.

start

Start time vector. Default is a vector of -Inf of same length as stop.

strata

Observations can belong in strata, labeled 1,2, .... If strata = NULL then all observations are in a single stratum.

weights

Observation weights, with default NULL.

tie_method

The tie-breaking method - one of "efron" (default) or "breslow".

Author

James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie hastie@stanford.edu

See Also

glm.gaussian, glm.binomial, glm.poisson, glm.multinomial, glm.multigaussian, glm.cox.

Examples

Run this code
n <- 100
start <- sample.int(20, size = n, replace = TRUE)
stop <- start + 1 + sample.int(5, size = n, replace = TRUE)
status <- rbinom(n, 1, 0.5)
strata <- sample(c(1,2), n, replace = TRUE)
obj1 <- glm.cox(stop, status)
obj2 <- glm.cox(stop, status, start = start)
obj3 <- glm.cox(stop, status, start = start, strata = strata)

Run the code above in your browser using DataLab