smoothproptest {proptest} | R Documentation |
The function performs the Neyman type smooth test of the proportional hazards assumption for an individual covariate or globally for all of the covariates in the Cox model for right censored survival data. Both a fixed and data-driven choice of the alternative model is possible.
smoothproptest(fit, covariate = 1, global = FALSE, dims = 4, basis = "legendre", time.transf = "F", data.driven = TRUE, nsim = 1000) ## S3 method for class 'smoothproptest': summary(object, ...)
fit |
a Cox model fit (an output of coxph ). |
covariate |
integer determining which covariate is to be tested
for proportionality. Only used if global is FALSE . |
global |
logical. Should the global test be performed? |
dims |
a vector or a single value. dims gives dimensions for
smooth modelling of the effects of respective covariates. 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. |
data.driven |
logical. Should the BIC be used to select the alternative? |
nsim |
the number of simulations to be carried out to compute the two-term approximation of the p-value. This is only used when the test is global. |
object |
an object of class "smoothproptest" , as returned
by the function smoothproptest . |
... |
further parameters for printing. |
The Neyman type smooth test of proportionality (time-constancy of the coefficient)
of an individual covariate against the alternative of the time-varying
coefficient consists of expressing the coefficient of the tested covariate as a
linear combination of basis functions and testing significance of the new
artificial time-dependent covariates using the partial likelihood score test.
The potentially time-varying effects of the covariates that are not tested
should be modelled as combinations of basis functions too (dims
gives
dimensions for smooth modelling of the effects of the covariates which are not
tested, and of the tested covariate). This makes it possible to perform individual
covariate tests. Not modelling the other covariates would be dangerous: the test
generally would not be able to distinguish which covariate is proportional and
which not. See Kraus (2008).
In the global test the coefficients of all of the covariates are expressed
as linear combinations of basis functions and tested for significance.
The vector dims
gives the number of the basis functions for each covariate.
Both individual and global tests can be data-driven which means that the alternative is selected by a BIC-like rule. For individual (covariate-specific) tests the number of basis functions for the tested covariate is selected (see Kraus, 2007a). For global tests, the order of approximation of possibly time-varying effects is selected for each of the covariates (see Kraus, 2007b, Chapter 6).
The distribution of data-driven test statistics is approximated by the two-term H-approximation (Kraus, 2007a,b) because the one-term asymptotic approximation is inaccurate.
If the test is data-driven, the summary
method prints details
on the selection procedure (statistics and penalised statistics for
each alternative model). This is equivalent to print(x, detail=TRUE, ...)
.
A list (an object of class "smoothproptest"
) containing some of input values,
the test statistic(s) and p-value(s). The most important components are:
stat |
the test statistic (stat.bic if data.driven=TRUE ,
stat.d otherwise). |
p |
the p-value corresponding to stat (one of p.d
or p.bic.h below). |
stat.d, stat.bic |
the test statistic of the fixed dimension and data-driven
test (the latter present only if data.driven is TRUE ). |
p.d |
the p-value of the fixed dimension test based on the asymptotic
chi-square with d df (p.d ). Here d is either
dims[covariate] for the individual covariate test or sum(dims)
for the global test. |
p.bic.asympt, p.bic.h |
p-values for the data-driven test. p.bic.asympt
is based on the asymptotic distribution (chi-square with 1 df for covariate-specific
tests, max of chi-square with 1 df for global tests) (inaccurate).
p.bic.h is based on the two-term approximation. |
scorestats, scorestats.penal |
statistics and penalised statistics for all alternative models (only for data-driven tests). |
alt |
all alternative models (only for data-driven tests). |
S |
the index of the selected alternative (only for data-driven tests).
alt[S,] is the selected alternative. |
David Kraus, http://www.davidkraus.net/
Kraus, D. (2007a) Data-driven smooth tests of the proportional hazards assumption. Lifetime Data Anal. 13, 1–16.
Kraus, D. (2007b) Neyman's smooth tests in survival analysis. PhD thesis. Charles University in Prague, Dept. of Statistics.
Kraus, D. (2008) Identifying nonproportional covariates in the Cox model. Comm. Statist. Theory Methods 37, 617–625.
## 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) ## Covariate-specific tests test1 = smoothproptest(fit,covariate=1) # testing Z_1 (nonproportional) summary(test1) # print details on the alternative models test2 = smoothproptest(fit,covariate=2) # testing Z_2 (proportional) summary(test2) # print details on the alternative models ## Global test test = smoothproptest(fit,global=TRUE) # global test summary(test) # print details on the alternative models