goftte (version 1.0.5)

fcov.coxph: Checking the functional form assumption for Cox model

Description

Diagnostics for the linear functional form of specific covariate(s) of the Cox model. The method is based on Lin's approximation of the randomly pertubed sum process (1993). Another approximation method recommended by Liu (2008) is also proposed. P-values are derived for supremum KS test statistics.

Usage

# S3 method for coxph
fcov(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

l x p matrix of unique covariates values for functional form. l is the maximum number of unique observations between the p covariates.

W

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

What

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

sdw

Standard error over covariates values 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.

Details

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

References

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 model
fit.coxph <- coxph(Surv(time,status)~ X1 + X2, data=d)
  
#Checking the covariates functional form assumption
fcov(fit.coxph) 
# }

Run the code above in your browser using DataLab