Description Usage Arguments Value Author(s) References See Also Examples
Calculates score processes and KS and Cvm tests for proportionaly of hazards via simulation (Martinussen and Scheike, 2006).
1 2 3 4 5 6 |
model |
Model object ( |
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.
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)
|
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.