gof (version 0.9.1)

cumres.coxph: Calculates GoF measures for Cox's propoportional hazard model for right censored survival times

Description

Calculates score processes and KS and Cvm tests for proportionaly of hazards via simulation (Martinussen and Scheike, 2006).

Usage

"cumres" (model, variable = c(colnames(model.matrix(model))), type = c("score", "residual"), R = 1000, plots = min(R, 50), seed = round(runif(1, 1, 1e+09)), ...)

Arguments

model
Model object (lm or glm)
variable
List of variable to order the residuals after
R
Number of samples used in simulation
type
Type of GoF-procedure
plots
Number of realizations to save for use in the plot-routine
seed
Random seed
...
additional arguments

Value

Returns an object of class 'cumres'.

References

Lin, D. Y. and Wei, L. J. and Ying, Z. (1993) Checking the Cox model with cumulative sums of martingale-based residuals Biometrika, Volume 80, No 3, p. 557-572.

Martinussen, Torben and Scheike, Thomas H. Dynamic regression models for survival data (2006), Springer, New York.

See Also

cumres.glm, coxph, and cox.aalen in the timereg package for similar GoF-methods for survival-data.

Examples

Run this code
library(survival)

simcox <- function(n=100, seed=1) {
  if (!is.null(seed))
    set.seed(seed)
  require(survival)
  time<-rexp(n); cen<-2*rexp(n);
  status<-(time<cen);
  time[status==0]<-cen[status==0];
  X<-matrix(rnorm(2*n),n,2)
  return(data.frame(time=time, status=status, X))
}
n <- 100; d <- simcox(n); m1 <- coxph(Surv(time,status)~ X1 + X2, data=d)
cumres(m1)

## Not run: 
# ## PBC example
# data(pbc)
# fit.cox <- coxph(Surv(time,status==2) ~ age + edema + bili + protime, data=pbc)
# system.time(pbc.gof <- cumres(fit.cox,R=2000))
# par(mfrow=c(2,2))
# plot(pbc.gof, ci=TRUE, legend=NULL)
# ## End(Not run)

Run the code above in your browser using DataLab