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 |
This package provides tools for the evaluation of the goodness of fit of the proportional hazards model.
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 coefficient of OQuigley and Flandre (1994) is provided. This coefficient is a measure of the predictive ability of the proportional hazards model.
Cecile Chauvel <[email protected]>
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. |
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)
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)
The function plots the standardized score process. This process is a list resulting of a call to the function standscore.
plotscore(s, printCB = FALSE , component.num = 1:dim(s[[1]])[2], main = "" , xlab = "Time", ylab = "Standardized score", ylim)
plotscore(s, printCB = FALSE , component.num = 1:dim(s[[1]])[2], main = "" , xlab = "Time", ylab = "Standardized score", ylim)
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). |
Cecile Chauvel
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)
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)
This function calcultates the coefficient of OQuigley and Flandre (1994) to evaluate the predictive capacity of the proportional hazards model (or Cox model).
R2(formula, data)
R2(formula, data)
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. |
The program does not handle ties in the data. We suggest to randomly split the ties before using the program.
If one covariate Z is present in the model, the coefficient is
where the sums are over the failures. is the expectation of
at the ith failure time under the model of parameter
= the maximum partial likelihood estimator of the regression coefficient.
is the expectation of
under the model of parameter 0 at the ith failure time.
If several covariates are present in the model, the coefficient is evaluated as in the previous case except that the covariate Z is replaced by the prognostic index
.
Cecile Chauvel
OQuigley J, Flandre P. (1994) Predictive capability of proportional hazards regression. PNAS 91, 2310-2314.
library(survival) data(ovarian) R2(futime+fustat~age,data=ovarian) R2(futime+fustat~age+rx,data=ovarian)
library(survival) data(ovarian) R2(futime+fustat~age,data=ovarian) R2(futime+fustat~age+rx,data=ovarian)
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.
standscore(formula, data, globstan = TRUE, beta0 = 0)
standscore(formula, data, globstan = TRUE, beta0 = 0)
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,
|
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. |
The program does not handle ties in the data. We suggest to randomly split the ties before using the program.
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. |
Cecile Chauvel
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. |
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)
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)
This function provides the statistic and the pvalue of the restrained adaptive test in Chauvel and OQuigley (2014).
testscore(formula, data, beta0=0, n_rep=10^6, digits=5)
testscore(formula, data, beta0=0, n_rep=10^6, digits=5)
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. |
The program does not handle ties in the data. We suggest to randomly split the ties before using the program.
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.
Cecile Chauvel
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. |
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)
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)