confint.predictCox: Confidence Intervals and Confidence Bands for the predicted...

Description Usage Arguments Details Author(s) Examples

View source: R/confint.predictCox.R

Description

Confidence intervals and confidence Bands for the predicted survival/cumulative Hazard.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'predictCox'
confint(
  object,
  parm = NULL,
  level = 0.95,
  n.sim = 10000,
  cumhazard.transform = "log",
  survival.transform = "loglog",
  seed = NA,
  ...
)

Arguments

object

A predictCox object, i.e. output of the predictCox function.

parm

[character] the type of predicted value for which the confidence intervals should be output. Can be "survival" or "cumhazard".

level

[numeric, 0-1] Level of confidence.

n.sim

[integer, >0] the number of simulations used to compute the quantiles for the confidence bands.

cumhazard.transform

[character] the transformation used to improve coverage of the confidence intervals for the cumlative hazard in small samples. Can be "none", "log".

survival.transform

[character] the transformation used to improve coverage of the confidence intervals for the survival in small samples. Can be "none", "log", "loglog", "cloglog".

seed

[integer, >0] seed number set before performing simulations for the confidence bands. If not given or NA no seed is set.

...

not used.

Details

The confidence bands and confidence intervals are automatically restricted to the interval of definition of the statistic, i.e. a confidence interval for the survival of [0.5;1.2] will become [0.5;1].

Author(s)

Brice Ozenne

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(survival)

#### generate data ####
set.seed(10)
d <- sampleData(40,outcome="survival") 

#### estimate a stratified Cox model ####
fit <- coxph(Surv(time,event)~X1 + strata(X2) + X6,
             data=d, ties="breslow", x = TRUE, y = TRUE)

#### compute individual specific survival probabilities  
fit.pred <- predictCox(fit, newdata=d[1:3], times=c(3,8), type = "survival",
                       se = TRUE, iid = TRUE, band = TRUE)
fit.pred

## check standard error
sqrt(rowSums(fit.pred$survival.iid[,,1]^2)) ## se for individual 1

## check confidence interval
newse <- fit.pred$survival.se/(-fit.pred$survival*log(fit.pred$survival))
cbind(lower = as.double(exp(-exp(log(-log(fit.pred$survival)) + 1.96 * newse))),
      upper = as.double(exp(-exp(log(-log(fit.pred$survival)) - 1.96 * newse)))
)

#### compute confidence intervals without transformation
confint(fit.pred, survival.transform = "none")
cbind(lower = as.double(fit.pred$survival - 1.96 * fit.pred$survival.se),
      upper = as.double(fit.pred$survival + 1.96 * fit.pred$survival.se)
)

riskRegression documentation built on Jan. 13, 2021, 11:12 a.m.