Learn R Programming

goftte (version 1.0.5)

prop.coxph: Checking proportional hazards assumption for Cox model

Description

Diagnostics for proportional hazards of specific covariate(s) of the Cox model. The limiting null distribution of the score process is approximated using either Lin's method (1993) or Liu's (2008). P-values are derived for KS, CvM and AD statistics.

Usage

# S3 method for coxph
prop(model, variable=NULL, type.test=c("Lin"), R=1000, plots=min(R,50), seed=NULL,...)

Arguments

model

Model object (coxph).

variable

Vector corresponding to the labels of each covariate. This is also an output argument.

type.test

Type of approximation. Values are "Lin" or "Liu". Default is "Lin".

R

Generation number used for Monte-Carlo simulations. This is also an output argument.

plots

Realizations number of Monte-Carlo simulations to save for use in the plot-routine.

seed

Random seed.

...

additional arguments.

Value

Returns an object of class 'scproc'. The main items of this object are :

obs

m x p matrix of unique times. m is the length of unique times.

W

The process \(U(\widehat{\beta},t)\).

What

The simulated limiting processes for the R-plots first Monte-Carlo realizations.

sdw

Standard error over time of What.

cvalues

R x p matrix whose components are the supremum of the standardized What process for each Monte-Carlo realization . The quantiles of this output argument are used to calculate the prediction bands in the plot-routine.

KS

Vector of the p rejection probabilities using KS type statistic.

CvM

Vector of the p rejection probabilities using CvM type statistic.

AD

Vector of the p rejection probabilities using AD type statistic.

Details

- The same type of function was proposed in gof package (cumres.coxph) at the difference that the autors only used Lin's method to approximate the limiting null distribution of the score process.

- A prop.cph function accepting models of cph type (rms package) is also included in the package, and uses the same arguments as prop.coxph. Contrary to prop.coxph, the use of 'x=TRUE' option for covariates design is now required in cph model. Strata and cluster options are not supported.

References

Holst KK (2014). gof: Model-diagnostics based on cumulative residuals. R package version 0.9.1, URL https://CRAN.R-project.org/package=gof.

Lin DY, Wei JL and Ying Z (1993).Checking the Cox model with cumulative sums of martingale-based residuals. Biometrika, 80(3), 557-572.

Liu M, Lu W and Shao (2008). A Monte Carlo approach for change-point detection in the Cox proportional hazards model. Statistics in Medecine, 27(19), 3894-3909.

Examples

Run this code
# NOT RUN {
require(survival)
  
#Simulating survival data
simcox <- function(n=100, seed=1) {
  if (!is.null(seed))
  set.seed(seed)
  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); 
  
#Fitting Cox's model
fit.coxph <- coxph(Surv(time,status)~ X1 + X2, data=d)
  
#Checking the proportional hazards assumption
prop(fit.coxph) 
# }

Run the code above in your browser using DataLab