scoreproptest {proptest}R Documentation

Test of the Proportional Hazards Assumption Based on the Score Process

Description

The function performs tests of the proportional hazards assumption for an individual covariate in the Cox model for right censored survival data. The tests of the Kolmogorov–Smirnov, Cramer–von Mises and Anderson–Darling type based on the component of the score process are computed and simulated p-values are returned.

Usage

scoreproptest(fit, covariate = 1, dims = 4, basis = "legendre",
              time.transf = "F", nsim = 1000, nsim.plot = 50,
              weight = "unit")

Arguments

fit a Cox model fit (an output of coxph).
covariate integer determining which covariate is to be tested for proportionality.
dims a vector or a single value. dims gives dimensions for smooth modeling of the effects of the covariates that are not tested. If dims is a single value and there is more than one covariate, the value is replicated.
basis a character string. Which basis of smooth functions is to be used? Possible values are "legendre" and "cos" (or "cosine").
time.transf a character string. The basis functions are evaluated at transformed times. With time.transf="F", the transformation is F_0(t)/F_0(tau) (F_0 is the distribution function corresponding to the baseline hazard). For time.transf="L", the transformation is Lambda_0(t)/Lambda_0(tau) (Lambda_0 is the cumulative baseline hazard). F_0 and Lambda_0 are estimated from the input model fit.
nsim the number of simulations to be carried out to approximate the p-value.
nsim.plot the number of simulated paths of the score process to be returned (intended for plotting with plot.scoreproptest).
weight a character string. The weighted process can be used. Possible values are "unit" (unweighted, default), "gehan" (nrisk/nevent) and "mm" ((nrisk-nrisk[nevent])^2/(nevent^2)) (Marzec and Marzec, 1997).

Details

The score process is used for assessment of the proportional hazards assumption (Lin, Wei and Ying, 1993). Each component of the score process reflects departures from proportionality (time-constancy of the effect) of the corresponding covariate.

However, tests based on individual components of the process are generally not capable to distinguish which covariate is proportional and which not. The method is only valid if the other covariates are proportional.

Therefore, the potentially time-varying effects of the covariates that are not tested are modeled as combinations of basis functions. The test is then based on the score process from this large model with artificial time-dependent covariates. This makes it possible to perform individual covariate tests. See Kraus (2006).

The vector dims gives the number of the basis functions for each covariate.

Value

A list (an object of class "scoreproptest"). The most important components are:

score.process the component of the score process corresponding to the tested covariate.
time the vector of the event times.
stat.ks the Kolmogorov–Smirnov test statistic.
p.ks the simulated p-value for the Kolmogorov–Smirnov test.
stat.cm the Cramer–von Mises test statistic.
p.cm the simulated p-value for the Cramer–von Mises test.
stat.ad the Anderson–Darling test statistic.
p.ad the simulated p-value for the Anderson–Darling test.
score.process.sim a matrix with nsim.plot columns containing simulated paths of the score process. These may be plotted with plot.scoreproptest.

Author(s)

David Kraus, http://www.davidkraus.net/

References

Kraus, D. (2006). Identifying nonproportional covariates in the Cox model. Research Report 2170, Institute of Information Theory and Automation, Prague.

Lin, D.Y., Wei, L.J. and Ying, Z. (1993). Checking the Cox model with cumulative sums of martingale-based residuals. Biometrika, 80, 557–572.

Marzec, L. and Marzec, P. (1997). Generalized martingale-residual processes for goodness-of-fit inference in Cox's type regression models. Ann. Statist., 25, 683–714.

See Also

plot.scoreproptest, smoothproptest, coxph

Examples

## Case 4 of Kvaloy & Neef (2004, Lifetime Data Anal.):
## data generated from the distribution with hazard rate
## \lambda(t)=\exp(0.5tZ_1+Z_2-8)
## (Z_1,Z_2) jointly normal with E=4, var=1, cor=rho
## censoring times uniform(0,5)

n = 200
rho = .3
z = matrix(rnorm(n*2),ncol=2) %*% chol(matrix(c(1,rho,rho,1),2)) + 4
a = .5
tim = 1/(a*z[,1]) * log(1-a*z[,1]*exp(-z[,2]+8)*log(runif(n)))
ct = 5*runif(n)
nc = tim<=ct
tim = pmin(tim,ct)
fit = coxph(Surv(tim,nc)~z)

par(mfrow=c(2,1))

test1 = scoreproptest(fit,covariate=1)   # testing Z_1 (nonproportional)
print(test1)
plot(test1,main="Score process for z1")

test2 = scoreproptest(fit,covariate=2)   # testing Z_2 (proportional)
print(test2)
plot(test2,main="Score process for z2")

par(mfrow=c(1,1))

[Package proptest version 0.1-1 Index]