Last data update: 2014.03.03

R: Gonen & Heller Concordance Probability Estimate for the Cox...
phcpe2R Documentation

Gonen & Heller Concordance Probability Estimate for the Cox Proportional Hazards model

Description

A function to calculate Gonen & Heller concordance probability estimate (CPE) for the Cox proportional hazards model.

Usage

phcpe2(coef,coef.var,design, CPE.SE=FALSE,out.ties=FALSE)

Arguments

coef

The coefficients of the Cox model.

coef.var

The covariance matrix of the coefficients of the Cox model.

design

A design matrix for covariates. The rows correspond to subjects, and the columns correspond to covariates.

CPE.SE

A logical value indicating whether the standard error of the CPE should be calculated

out.ties

If out.ties is set to FALSE,pairs of observations tied on covariates will be used to calculate the CPE. Otherwise, they will not be used.

Value

CPE

Concordance Probability Estimate

CPE.SE

the Standard Error of the Concordance Probability Estimate

Author(s)

Qianxing Mo, Mithat Gonen and Glenn Heller; qmo@bcm.edu

References

Mithat Gonen and Glenn Heller. (2005). Concordance probability and discriminatory power in proportional hazards regression. Biometrika, 92, 4, pp.965-970

Examples


### create a simple data set for testing
set.seed(199)
nn <- 1000
time <- rexp(nn)
status <- sample(0:1, nn, replace=TRUE)
covar <- matrix(rnorm(3*nn), ncol=3)
survd <- data.frame(time, status, covar)
names(survd) <- c("time","status","x1","x2","x3")

coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd)

phcpe(coxph.fit,CPE.SE=TRUE)
phcpe2(coef=coxph.fit$coefficients,coef.var=coxph.fit$var,design=model.matrix(coxph.fit))

#*** For unknown reason, 'coxph.fit' may need to be removed before running cph()***
rm(coxph.fit)

cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow")

### Calculate CPE only (needs much less time).
phcpe2(cph.fit$coefficients,coef.var=cph.fit$var,design=model.matrix(cph.fit),CPE.SE=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CPE)
Loading required package: survival
Loading required package: rms
Loading required package: Hmisc
Loading required package: lattice
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CPE/phcpe2.Rd_%03d_medium.png", width=480, height=480)
> ### Name: phcpe2
> ### Title: Gonen & Heller Concordance Probability Estimate for the Cox
> ###   Proportional Hazards model
> ### Aliases: phcpe2
> ### Keywords: survival
> 
> ### ** Examples
> 
> 
> ### create a simple data set for testing
> set.seed(199)
> nn <- 1000
> time <- rexp(nn)
> status <- sample(0:1, nn, replace=TRUE)
> covar <- matrix(rnorm(3*nn), ncol=3)
> survd <- data.frame(time, status, covar)
> names(survd) <- c("time","status","x1","x2","x3")
> 
> coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd)
> 
> phcpe(coxph.fit,CPE.SE=TRUE)
$CPE
[1] 0.5113818

$CPE.SE
[1] 0.0124193

> phcpe2(coef=coxph.fit$coefficients,coef.var=coxph.fit$var,design=model.matrix(coxph.fit))
$CPE
[1] 0.5113818

> 
> #*** For unknown reason, 'coxph.fit' may need to be removed before running cph()***
> rm(coxph.fit)
> 
> cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow")
> 
> ### Calculate CPE only (needs much less time).
> phcpe2(cph.fit$coefficients,coef.var=cph.fit$var,design=model.matrix(cph.fit),CPE.SE=TRUE)
$CPE
[1] 0.5113818

$CPE.SE
[1] 0.0124193

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>