text: Fits a Cox proportional hazards regression model. Time dependent variables, time dependent strata, multiple events per subject, and other extensions are incorporated using the counting process formulation of Andersen and Gill.
  coxph(formula, data=, weights, subset, na.action, init, control, ties=c("efron","breslow","exact"), singular.ok=TRUE, robust, model=FALSE, x=FALSE, y=TRUE, tt, method=ties, id, cluster, istate, statedata, ...)
  a formula object, with the response on the left of a
  Surv function.
  ~operator, and the terms on the right. The response must be a survival object as returned by the
  a data.frame in which to interpret the variables named in
  the
  formula, or in the
  subset and the
  weights
  argument.
  vector of case weights, see the note below. For a thorough discussion of these see the book by Therneau and Grambsch.
  expression indicating which subset of the rows of data should be used in the fit. All observations are included by default.
  a missing-data filter function. This is applied to the model.frame
  after any
  subset argument has been used. Default is
  options()\$na.action.
  vector of initial values of the iteration. Default initial value is zero for all variables.
  Object of class
  coxph.control specifying iteration limit
  and other control options. Default is
  coxph.control(...)..
  should a robust variance be computed.
  The default is TRUE if: there is a
  cluster argument, there
  are case weights that are not 0 or 1, or there are
  id values
  with more than one event.
  optional variable name that identifies subjects. Only
  necessary when a subject can have multiple rows in the data, and
  there is more than one event type. This variable will normally be
  found in
  data.
  optional variable which clusters the observations, for
  the purposes of a robust variance. If present, it implies
  robust.
  This variable will normally be found in
  data.
  optional variable giving the current state at the start
  each interval. This variable will normally be found in
  data.
  optional data set used to describe multistate models.
  logical value: if
  TRUE, the model frame is returned in component
  model.
  logical value: if
  TRUE, the x matrix is returned in
  component
  x.
  logical value: if
  TRUE, the response vector is returned in
  component
  y.
  optional list of time-transform functions.
  alternate name for the
  ties argument.
  Other arguments will be passed to
  coxph.control
  an object of class
  coxph representing the fit.
  See
  coxph.object for details. option to the
  coxph call to obviate the
  need for reconstruction, at the expense of a larger
  fit
  object..=TRUE.
  One user mistake that has recently arisen is to slavishly follow the
  advice of some coding guides and prepend
  survival:: onto
  everthing, including the special terms, e.g.,
  survival::coxph(survival:Surv(time, status) ~ age +
  survival::cluster(inst), data=lung)
  First, this is unnecessary: arguments within the
  coxph call will
  be evaluated within the survival namespace, so another package's Surv or
  cluster function would not be noticed.
  (Full qualification of the coxph call itself may be protective, however.)
  Second, and more importantly, the call just above will not give the
  correct answer. The specials are recognized by their name, and
  `survival::cluster' is not the same as `cluster'; the above model would
  treat
  inst as an ordinary variable.
  A similar issue arises from using
  stats::offset as a term, in
  either survival or glm models.. (Most often number 1 is the first to occur.) The routine attempts to detect when this has happened, not always successfully. The primary consequence for the user is that the Wald statistic = coefficient/se(coefficient) is not valid in this case and should be ignored; the likelihood ratio and score tests remain valid however. 180 subjects are at risk on day 7 of which 15 had an event;.
  A separate issue is that of artificial ties due to floating-point
  imprecision. See the vignette on this topic for a full explanation or
  the
  timefix option in
  coxph.control.
  Users may need to add
  timefix=FALSE for simulated data sets.. In general, however, users should not avoid very large numeric values for an offset due to possible loss of precision in the estimates.
  Andersen, P. and Gill, R. (1982). Cox's regression model for counting processes, a large sample study. Annals of Statistics 10, 1100-1120.
  Therneau, T., Grambsch, P., Modeling Survival Data: Extending the Cox Model. Springer-Verlag, 2000.
  coxph.object,
  coxph.control,
  cluster,
  strata,
  Surv,
  survfit,
  pspline,
  ridge.
  # NOT RUN { #)) # }
  Run the code above in your browser using DataCamp Workspace