cumres.coxph: Calculates GoF measures for Cox's propoportional hazard model...

Description Usage Arguments Value Author(s) References See Also Examples

Description

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

Usage

1
2
3
4
5
6
  ## S3 method for class 'coxph'
 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'.

Author(s)

Klaus K. Holst and Thomas Scheike

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)

Example output

Loading 'gof' version 0.9.1

Kolmogorov-Smirnov-test: p-value=0.237
Cramer von Mises-test: p-value=0.301
Based on 1000 realizations. Cumulated residuals ordered by X1-variable.
---
Kolmogorov-Smirnov-test: p-value=0.202
Cramer von Mises-test: p-value=0.234
Based on 1000 realizations. Cumulated residuals ordered by X2-variable.
---
   user  system elapsed 
  5.093   0.000   5.105 

gof documentation built on May 2, 2019, 5:52 p.m.