cumres.coxph {gof} | R Documentation |
Currently only implemented for score processes which serves as tests for proportionaly of hazards.
## S3 method for class 'coxph': cumres (model, variable=c(colnames(model.matrix(model))), type=c("score","residual"), R=500, plots=min(R,50), seed=round(runif(1,1,1e9)), ...)
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 |
Returns an object of class 'cumres'.
Klaus K. Holst and Thomas Scheike
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.
cumres.glm
,
coxph
, and
cox.aalen
in the timereg-package
for similar GOF-methods for survival-data.
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); model <- coxph(Surv(time,status)~ X1 + X2, data=d, robust=TRUE) dtimes <- sort(d$time[d$status==1]) system.time(a <- cumres(model)) summary(a) ## PBC example data(pbc) fit.cox <- coxph(Surv(time,status) ~ 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)