groupci: make calibration curve for competing risks endpoint

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/groupci.R

Description

Cumulative Incidence Estimates vs. a Continuous Variable

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
groupci(
  x,
  ftime,
  fstatus,
  cencode = 0,
  failcode = 1,
  ci = TRUE,
  m = 50,
  g,
  cuts,
  u,
  pl = TRUE,
  conf.int = 0.95,
  xlab,
  ylab,
  xlim = c(0, 1),
  ylim = c(0, 1),
  lty = 1,
  add = FALSE,
  cex.subtitle = FALSE,
  ab = TRUE,
  ...
)

Arguments

x

a continuous variable

ftime

vector of follow-up time

fstatus

vector of failure status

cencode

value indicating cencering.

failcode

value indicating event of interest

ci

logical flag to output event free probability if setting FALSE

m

desired minimum number of observations in a group

g

number of quantile groups

cuts

actual cuts in x, e.g. c(0,1,2) to use [0,1), [1,2].

u

time for which to estimate cumulative incidence

pl

TRUE to plot results

conf.int

defaults to .95 for 0.95 confidence bars. Set to FALSE to suppress bars

xlab

if pl=TRUE, is x-axis label. Default is label(x) or name of calling argument

ylab

if pl=TRUE, is y-axis label. Default is constructed from u and time units

xlim

range of x axis

ylim

range of y axis

lty

line time for primary line connecting estimates

add

set to TRUE if adding to an existing plot

cex.subtitle

character size for subtitle. Default is .7. Use FALSE to suppress subtitle.

ab

TRUE to add a 45 degree line

...

plotting parameters to pass to the plot and errbar functions

Details

Function to divide a continuous variable x (e.g. age, or predicted cumulative incidence at time u created by predict.cmprsk into g quantile groups, get cumulative incidence estimates at time u (a scaler), and to return a matrix with columns x=mean x in quantile, n=number of subjects, events=no. events, and ci= cumulattive incidence at time u, std.err = standard error. Instead of supplying g, the user can supply the minimum number of subjects to have in the quantile group (m, default=50). If cuts is given (e.g. cuts=c(0,.1,.2,...{},.9,.1)), it overrides m and g.

Value

matrix with columns named x (mean predictor value in interval), n (sample size in interval), events (number of events in interval), ci (cumulative incidence estimate), std.err (standard error of cumulative incidence)

Note

This function is adapted from Harrell's function groupkm.

Author(s)

Changhong Yu, Michael Kattan, Ph.D
Department of Quantitative Health Sciences
Cleveland Clinic

See Also

groupkm, cuminc,pred.ci

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(prostate.dat)
dd <- datadist(prostate.dat)
options(datadist = "dd")
prostate.f <- cph(Surv(TIME_EVENT,EVENT_DOD == 1) ~ TX  + rcs(PSA,3) +
           BX_GLSN_CAT +  CLIN_STG + rcs(AGE,3) +
           RACE_AA, data = prostate.dat,
           x = TRUE, y= TRUE, surv=TRUE,time.inc = 144)
prostate.crr <- crr.fit(prostate.f,cencode = 0,failcode = 1)

## ten fold cross validation
prostate.dat$preds.tenf.cv.prostate.crr.120 <-
                                       tenf.crr(prostate.crr,time = 120)

with(prostate.dat,
     groupci(preds.tenf.cv.prostate.crr.120 , ftime = TIME_EVENT,
             fstatus =EVENT_DOD, g = 5, u = 120,
             xlab = "Nomogram predicted 10-year cancerspecific mortality",
             ylab = "Observed predicted 10-year cancerspecific mortality")
)

jixccf/QHScrnomo documentation built on Dec. 21, 2021, 12:08 a.m.