Learn R Programming

eha (version 1.2-18)

coxreg: Cox regression

Description

Performs Cox regression with some special attractions, especially sampling of risksets and the weird bootstrap.

Usage

coxreg(formula = formula(data), data = parent.frame(), weights, t.offset,
na.action = getOption("na.action"), init = NULL,
method = c("efron", "breslow", "mppl", "ml"),
control = list(eps = 1e-08, maxiter = 25, trace = FALSE),
singular.ok = TRUE, model = FALSE,
center = TRUE,
x = FALSE, y = TRUE, boot = FALSE, efrac = 0,
geometric = FALSE, rs = NULL,
frailty = NULL, max.survs = NULL)

Arguments

formula
a formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the Surv function.
data
a data.frame in which to interpret the variables named in the formula.
weights
Case weights; time-fixed or time-varying.
t.offset
Case offsets; time-varying.
na.action
a missing-data filter function, applied to the model.frame, after any subset argument has been used. Default is options()$na.action.
init
vector of initial values of the iteration. Default initial value is zero for all variables.
method
Method of treating ties, "efron" (default), "breslow", "mppl" (maximum partial partial likelihood), or "ml" (maximum likelihood).
control
a list with components eps (convergence criterion), maxiter (maximum number of iterations), and silent (logical, controlling amount of output). You can change any component without mention the other(s).
singular.ok
Not used
model
Not used
center
If TRUE, the hazards are calculated at the means of the covariates. If FALSE, at zero.
x
Return the design matrix in the model object?
y
return the response in the model object?
rs
Risk set?
boot
Number of boot replicates. Defaults to FALSE, no boot samples.
efrac
Upper limit of fraction failures in 'mppl'.
geometric
If TRUE, forces an 'ml' model with constant riskset probability. Default is FALSE.
frailty
Grouping variable for frailty analysis. Not in use yet.
max.survs
Sampling of risk sets? If given, it should be (the upper limit of) the number of survivors in each risk set.

Value

  • A list of class c("coxreg", "coxph") with components
  • coefficientsFitted parameter estimates.
  • varCovariance matrix of the estimates.
  • loglikVector of length two; first component is the value at the initial parameter values, the second componet is the maximized value.
  • scoreThe score test statistic (at the initial value).
  • linear.predictorsThe estimated linear predictors.
  • residualsThe martingale residuals.
  • hazardThe estimated baseline hazard.
  • meansMeans of the columns of the design matrix.
  • w.meansWeighted (against exposure time) means of covariates; weighted relative frequencies of levels of factors.
  • nNumber of spells in indata (possibly after removal of cases with NA's).
  • eventsNumber of events in data.
  • termsUsed by extractor functions.
  • assignUsed by extractor functions.
  • wald.testThe Walt test statistic (at the initial value).
  • yThe Surv vector.
  • isFLogical vector indicating the covariates that are factors.
  • covarsThe covariates.
  • ttrTotal Time at Risk.
  • levelsList of levels of factors.
  • formulaThe calling formula.
  • bootstrapThe (matrix of) bootstrap replicates, if requested on input. It is up to the user to do whatever desirable with this sample.
  • boot.sdThe estimated standard errors of the bootstrap replicates.
  • callThe call.
  • methodThe method.
  • convergenceDid the optimization converge?
  • failDid the optimization fail? (Is NULL if not).

Warning

The use of rs is dangerous, see note. It can however speed up computing time considerably for huge data sets.

Details

The default method, efron, and the alternative, breslow, are both the same as in coxph in package survival. The methods mppl and ml are maximum likelihood based.

References

Brostr�m, G. and Lindkvist, M. (2008). Partial partial likelihood. Communications in Statistics: Simulation and Computation 37:4, 679-686.

See Also

coxph, risksets

Examples

Run this code
dat <- data.frame(time=  c(4, 3,1,1,2,2,3),
                status=c(1,1,1,0,1,1,0),
                x=     c(0, 2,1,1,1,0,0),
                sex=   c(0, 0,0,0,1,1,1))
 coxreg( Surv(time, status) ~ x + strata(sex), data = dat) #stratified model
 # Same as:
 rs <- risksets(Surv(dat$time, dat$status), strata = dat$sex)
 coxreg( Surv(time, status) ~ x, data = dat, rs = rs) #stratified model

Run the code above in your browser using DataLab