Package 'PHeval'

Title: Evaluation of the Proportional Hazards Assumption and Test for Comparing Survival Curves with a Standardized Score Process
Description: Provides tools for the test for the comparison of survival curves, the evaluation of the goodness-of-fit and the predictive capacity of the proportional hazards model.
Authors: Cecile Chauvel [aut, cre]
Maintainer: Cecile Chauvel <[email protected]>
License: GPL (>= 2.0)
Version: 1.1
Built: 2024-11-02 03:11:17 UTC
Source: https://github.com/cran/PHeval

Help Index


Evaluation of the proportional hazards assumption with a standardized score process

Description

This package provides tools for the evaluation of the goodness of fit of the proportional hazards model.

Details

Package: PHeval
Type: Package
Version: 1.1
Date: 2024-09-02
License: GPL (>=2.0)

This package provides functions to compute and plot the standardized score process of OQuigley (2008). The mathematical properties of this process are studied in Chauvel (2014). The restrained adaptive test introduced in Chauvel and OQuigley (2014) is implemented. The plot of this process over the ranks of the failure times gives an indication of the validity of the proportional hazards assumption. A function to evaluate the R2R^2 coefficient of OQuigley and Flandre (1994) is provided. This coefficient is a measure of the predictive ability of the proportional hazards model.

Author(s)

Cecile Chauvel <[email protected]>

References

Chauvel, C (2014). PhD thesis (in French): Processus empiriques pour l'inférence dans le
modèle de survie à risques non proportionnels.
Université Pierre et Marie Curie - Paris VI.
Chauvel, C, OQuigley, J (2014). Tests for comparing estimated survival functions.
Biometrika 101, 3, 535 – 552.
OQuigley, J (2008). Proportional hazards regression. Springer New-York.
OQuigley, J, Flandre, P (1994). Predictive capability of proportional hazards regression. PNAS 91, 2310-2314.

Examples

library(survival)
S=standscore(futime+fustat~resid.ds+rx,data=ovarian)
plotscore(S,printCB = TRUE)
testscore(futime+fustat~resid.ds+rx,data=ovarian)
R2(futime+fustat~resid.ds+rx,data=ovarian)

Plot of the standardized score process

Description

The function plots the standardized score process. This process is a list resulting of a call to the function standscore.

Usage

plotscore(s, printCB = FALSE , component.num = 1:dim(s[[1]])[2], 
main = "" , xlab = "Time", ylab = "Standardized score", ylim)

Arguments

s

A list resulting from a call to the function standscore which corresponds to the standardized score process and, possibly, its confidence bands.

printCB

Set printCB = TRUE for plotting the confidence bands. Default is printCB = FALSE.

component.num

A vector of length equals to or lower than the number of covariates. It indicates which components of the process to plot. For example, set component.num=c(2,3) for plotting the second and third components. By default, all components are plotted.

main, xlab, ylab, ylim

Usual arguments for plotting. See help(plot).

Author(s)

Cecile Chauvel

See Also

standscore

Examples

library(survival)
data(ovarian)

#############################################
# Evaluation and plot of the standardized score process at parameter beta0 = 0
score1=standscore(futime+fustat~age+rx,data=ovarian)
plotscore(score1,printCB=TRUE)


#############################################
# Evaluation of the standardized score process at parameter
# beta0 = maximum partial likelihood estimator of beta
beta=coxph(Surv(futime,fustat)~age+rx,data=ovarian)$coeff
score2=standscore(futime+fustat~age+rx,data=ovarian,beta0=beta)

# Separated plots for each regression effect
par(mfrow=c(1,2))
plotscore(score2,printCB=TRUE,component.num=1,main="age")
plotscore(score2,printCB=TRUE,component.num=2,main="rx")

#############################################
# Evaluation and plot of the standardized score process at parameter beta0 = 0
# without global standardization 
score3=standscore(futime+fustat~age+rx,data=ovarian,globstan=FALSE)
plotscore(score3)

R2 coefficient

Description

This function calcultates the R2R^2 coefficient of OQuigley and Flandre (1994) to evaluate the predictive capacity of the proportional hazards model (or Cox model).

Usage

R2(formula, data)

Arguments

formula

A formula object or character string with the time and censoring status separated by "+" on the left hand side and the covariates separated by "+" on the right. For instance, if the time name is "Time", the censoring status is "Status" and the covariates are called "Cov1" and "Cov2", the formula is "Time+Status~Cov1+Cov2".

data

A data.frame with the data. The censoring status should be 1 for failure and 0 for censoring. No missing data accepted.

Details

The program does not handle ties in the data. We suggest to randomly split the ties before using the program.

Value

  • If one covariate Z is present in the model, the R2R^2 coefficient is

    R2=1(ZiEb(Zi))2(ZiE0(Zi))2,R^2=1-\frac{\sum(Zi-E_b(Zi))^2}{\sum(Zi-E_0(Zi))^2},

    where the sums are over the failures. Eb(Zi)E_b(Zi) is the expectation of ZZ at the ith failure time under the model of parameter bb = the maximum partial likelihood estimator of the regression coefficient. E0(Zi)E_0(Zi) is the expectation of ZZ under the model of parameter 0 at the ith failure time.

  • If several covariates are present in the model, the R2R^2 coefficient is evaluated as in the previous case except that the covariate Z is replaced by the prognostic index bZb'Z.

Author(s)

Cecile Chauvel

References

OQuigley J, Flandre P. (1994) Predictive capability of proportional hazards regression. PNAS 91, 2310-2314.

Examples

library(survival)
data(ovarian)
R2(futime+fustat~age,data=ovarian)
R2(futime+fustat~age+rx,data=ovarian)

Standardized Score Process

Description

This function evaluates the standardized score process. The process helps for evaluating the goodness of fit of the proportional hazards model and visualizing the shape of time-dependent effects. It is also used in tests of comparison of survival curves.

Usage

standscore(formula, data, globstan = TRUE, beta0 = 0)

Arguments

formula

A formula object or character string with the time and censoring status separated by "+" on the left hand side and the covariates separated by "+" on the right. For instance, if the time name is "Time", the censoring status is "Status" and the covariates are "Cov1" and "Cov2", the formula is "Time+Status~Cov1+Cov2".

data

A data.frame with the data. The censoring status should be 1 for failure and 0 for censoring. No missing data accepted.

globstan

With one covariate in the model, globstan has no effect. With several covariates,

  • if globstan = TRUE (default) a global standardization by the matrix Sigma is applied to the process. Sigma is the estimator of the variance-covariance matrix between the covariates to the power of - 1 / 2. With this sandardization, each component of the process represents the cumulative regression effect of each covariates.

  • if globstan = FALSE, no standardization is applied. In this case, the components of the process are dependent and do not reflect the shapes of the cumulative effects. The confidence bands are not given. The use of globstan = FALSE is aimed at performing tests of the value of the regression coefficients (null hypothesis : regression parameter = beta0).

beta0

A vector of parameters to evaluate the process (by default, parameters set to 0). Its length is the number of covariates. Each value corresponds to the regression coefficient for a covariate, in the same order as appearing in formula.

Details

The program does not handle ties in the data. We suggest to randomly split the ties before using the program.

Value

Score

A vector or matrix with the value of the standardized score process. Each row corresponds to a failure time, each column to a covariate.

Sigma

The matrix used for the standardization of the process. Sigma is the estimator of the variance-covariance matrix between the covariates to the power of - 1 / 2. This value is present only with multiple covariates and globstan = TRUE.

confbandCOV

A matrix with the confidence bands of the process for a constant regression effect associated with the covariate named COV. Each row corresponds to a failure time. The first column is the lower band and the second column is the upper band. This value is present with one covariate or with multiple covariates and globstan = TRUE.

Author(s)

Cecile Chauvel

References

Chauvel, C, OQuigley, J (2014) Tests for comparing estimated survival functions. Biometrika
101, 3, 535 – 552.
Chauvel, C (2014). PhD thesis (in French): Processus empiriques pour l'inférence dans le
modèle de survie à risques non proportionnels.
Université Pierre et Marie Curie - Paris VI.

See Also

plotscore

Examples

library(survival)
data(ovarian)

#############################################
# Evaluation and plot of the standardized score process at parameter beta0 = 0

score1=standscore(futime+fustat~age+rx,data=ovarian)
plotscore(score1,printCB=TRUE)


#############################################
# Evaluation of the standardized score process at parameter
# beta0 = maximum partial likelihood estimator of beta in the Cox model

beta=coxph(Surv(futime,fustat)~age+rx,data=ovarian)$coeff
score2=standscore(futime+fustat~age+rx,data=ovarian,beta0=beta)

# Separated plots for each regression effect

par(mfrow=c(1,2))
plotscore(score2,printCB=TRUE,component.num=1,main="age")
plotscore(score2,printCB=TRUE,component.num=2,main="rx")

#############################################
# Evaluation and plot of the standardized score process at parameter beta0 = 0
# without global standardization 

fo="futime+fustat~age+rx"
score3=standscore(fo,data=ovarian,globstan=FALSE)
plotscore(score3)

Restrained adaptive test based on the standardized score process

Description

This function provides the statistic and the pvalue of the restrained adaptive test in Chauvel and OQuigley (2014).

Usage

testscore(formula, data, beta0=0, n_rep=10^6, digits=5)

Arguments

formula

A formula object or character string with the time and censoring status separated by "+" on the left hand side and the covariates separated by "+" on the right. For instance, if the time name is "Time", the censoring status is "Status" and the covariates are "Cov1" and "Cov2", the formula is "Time+Status~Cov1+Cov2". No interaction can be provided.

data

A data frame with the data. The censoring status should be 1 for failure and 0 for censoring. No missing data are accepted.

beta0

A vector of parameters to test in the null hypothesis H_0: beta = beta0. By default, beta0 = 0. Its length is the number of covariates. Each value corresponds to the regression coefficient for a covariate, in the same order as appearing in formula.

n_rep

An integer for the number of simulations for the estimation of the p-value. It must be higher than 10^5.

digits

An integer for the number of decimal places to be used in the results.

Details

The program does not handle ties in the data. We suggest to randomly split the ties before using the program.

Value

A table with 3 lines, one for each of the following test: distance from origin, area under the curve (AUC) and restrained adaptive tests. For each test, the value of the statistic and the p-value are given, with the specified number of digits.

Author(s)

Cecile Chauvel

References

Chauvel, C, OQuigley, J (2014) Tests for comparing estimated survival functions. Biometrika
101, 3, 535 – 552.
Chauvel, C (2014). PhD thesis (in French): Processus empiriques pour l'inférence dans le
modèle de survie à risques non proportionnels.
Université Pierre et Marie Curie - Paris VI.

See Also

standscore plotscore

Examples

library(survival)
data(ovarian)

#############################################
# Tests for H_0: beta = 0 for both age and rx covariates

testscore(formula=futime+fustat~age+rx,data=ovarian)

#############################################
# Tests for H_0: beta=  maximum partial likelihood estimator of beta in the Cox model

beta_cox=coxph(Surv(futime,fustat)~ age+rx,data=ovarian)$coeff

testscore(formula=futime+fustat~age+rx,data=ovarian,beta0=beta_cox)