ci: *c*onfidence *i*ntervals for survival curves.

Description Usage Arguments Details Value Note Source References See Also Examples

View source: R/ci.R

Description

confidence intervals for survival curves.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ci(x, ...)

## S3 method for class 'ten'
ci(x, ..., CI = c("0.95", "0.9", "0.99"), how = c("point",
  "nair", "hall"), trans = c("log", "lin", "asi"), tL = NULL, tU = NULL,
  reCalc = FALSE)

## S3 method for class 'stratTen'
ci(x, ..., CI = c("0.95", "0.9", "0.99"),
  how = c("point", "nair", "hall"), trans = c("log", "lin", "asi"),
  tL = NULL, tU = NULL)

Arguments

x

An object of class ten.

CI

Confidence intervals. As the function currently relies on lookup tables, currently only 90%, 95% (the default) and 99% are supported.

how

Method to use for confidence interval.
point (the default) uses pointwise confirence intervals.
The alternatives use confidence bands (see details).

trans

Transformation to use.
The default is trans="log".
Also supported are linear and arcsine-square root transformations.

tL

Lower time point. Used in construction of confidence bands.

tU

Upper time point. Used in construction of confidence bands.

...

Additional arguments (not implemented).

reCalc

Recalcuate the values?
If reCalc=FALSE (the default) and the ten object already has the calculated values stored as an attribute, the value of the attribute is returned directly.

Details

In the equations below

sigma^2(t) = V[S(t)]/[S(t)]^2

Where S(t) is the Kaplan-Meier survival estimate and V[S(t)] is Greenwood's estimate of its variance.
The pointwise confidence intervals are valid for individual times, e.g. median and quantile values. When plotted and joined for multiple points they tend to be narrower than the bands described below. Thus they tend to exaggerate the impression of certainty when used to plot confidence intervals for a time range. They should not be interpreted as giving the intervals within which the entire survival function lies.
For a given significance level alpha, they are calculated using the standard normal distribution Z as follows:

Confidence bands give the values within which the survival function falls within a range of timepoints.

The time range under consideration is given so that tL >= min(t), the minimum or lowest event time and tU <= max(t), the maximum or largest event time.
For a sample size n and 0 < a_l < a_u <1:

a_l = n*sigma^2(t_l) / [1+n*sigma^2(t_l)]

a_u = n*sigma^2(t_u) / [1+n*sigma^2(t_u)]

For the Nair or equal precision (EP) confidence bands, we begin by obtaining the relevant confidence coefficient c[alpha]. This is obtained from the upper a-th fractile of the random variable

U = sup{ |W(x)[x(1-x)]^0.5|, a_l <= x <= a_u}

Where W is a standard Brownian bridge.
The intervals are:

For the Hall-Wellner bands the confidence coefficient k[alpha] is obtained from the upper a-th fractile of a Brownian bridge.
In this case t_l can be =0.
The intervals are:

Value

The ten object is modified in place by the additional of a data.table as an attribute.
attr(x, "ci") is printed.
This A survfit object. The upper and lower elements in the list (representing confidence intervals) are modified from the original.
Other elements will also be shortened if the time range under consideration has been reduced from the original.

Note

Source

The function is loosely based on km.ci::km.ci.

References

Nair V, 1984. Confidence bands for survival functions with censored data: a comparative study. Technometrics. 26(3):265-75. JSTOR.

Hall WJ, Wellner JA, 1980. Confidence bands for a survival curve from censored data. Biometrika. 67(1):133-43. JSTOR.

See Also

sf

quantile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## K&M 2nd ed. Section 4.3. Example 4.2, pg 105.
data("bmt", package="KMsurv")
b1 <- bmt[bmt$group==1, ] # ALL patients
## K&M 2nd ed. Section 4.4. Example 4.2 (cont.), pg 111.
## patients with ALL
t1 <- ten(Surv(t2, d3) ~ 1, data=bmt[bmt$group==1, ])
ci(t1, how="nair", trans="lin", tL=100, tU=600)
## Table 4.5, pg. 111.
lapply(list("lin", "log", "asi"),
       function(x) ci(t1, how="nair", trans=x, tL=100, tU=600))
## Table 4.6, pg. 111.
lapply(list("lin", "log", "asi"),
       function(x) ci(t1, how="hall", trans=x, tL=100, tU=600))
t1 <- ten(Surv(t2, d3) ~ group, data=bmt)
ci(t1, CI="0.95", how="nair", trans="lin", tL=100, tU=600)
## stratified model
data("pbc", package="survival")
t1 <- ten(coxph(Surv(time, status==2) ~ log(bili) + age + strata(edema), data=pbc))
ci(t1)

Example output

Loading required package: survival
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper
[[1]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

[[2]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

[[3]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

[[1]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

[[2]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

[[3]]
    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
    cg   t    S     Sv    SCV lower upper

    cg   t    S     Sv    SCV lower upper
 1:  1 100 0.87  0.003  0.004  0.71     1
 2:  1 110 0.84 0.0035 0.0049  0.67     1
 3:  1 110 0.82  0.004 0.0059  0.63     1
 4:  1 110 0.79 0.0044  0.007   0.6  0.98
 5:  1 120 0.74 0.0051 0.0094  0.53  0.94
 6:  1 130 0.71 0.0054  0.011   0.5  0.92
 7:  1 170 0.68 0.0057  0.012  0.47   0.9
 8:  1 190 0.66 0.0059  0.014  0.44  0.88
 9:  1 190 0.63 0.0061  0.015  0.41  0.86
10:  1 230 0.63 0.0061  0.015  0.41  0.86
11:  1 230  0.6 0.0063  0.017  0.37  0.83
12:  1 280 0.58 0.0065  0.019  0.34  0.81
13:  1 330 0.55 0.0066  0.022  0.32  0.78
14:  1 380 0.52 0.0067  0.025  0.29  0.76
15:  1 420 0.49 0.0067  0.027  0.26  0.73
16:  1 470 0.47 0.0067  0.031  0.23   0.7
17:  1 490 0.44 0.0066  0.034   0.2  0.67
18:  1 530 0.41 0.0065  0.039  0.18  0.64
19:  1 530 0.41 0.0065  0.039  0.18  0.64
20:  2 100 0.87 0.0021 0.0028  0.75  0.99
21:  2 210 0.85 0.0023 0.0032  0.72  0.98
22:  2 220 0.83 0.0026 0.0037   0.7  0.97
23:  2 250 0.81 0.0028 0.0042  0.67  0.96
24:  2 270  0.8  0.003 0.0047  0.65  0.94
25:  2 290 0.78 0.0032 0.0053  0.63  0.93
26:  2 380 0.76 0.0034 0.0059   0.6  0.92
27:  2 390 0.74 0.0036 0.0065  0.58   0.9
28:  2 410 0.72 0.0037 0.0071  0.56  0.89
29:  2 420  0.7 0.0039 0.0078  0.54  0.87
30:  2 480 0.69  0.004 0.0085  0.52  0.85
31:  2 490 0.67 0.0041 0.0093  0.49  0.84
32:  3 100 0.69 0.0048   0.01   0.5  0.88
33:  3 100 0.67 0.0049  0.011  0.47  0.86
34:  3 110 0.64 0.0051  0.012  0.45  0.84
35:  3 120 0.62 0.0052  0.013  0.42  0.82
36:  3 120  0.6 0.0053  0.015   0.4   0.8
37:  3 160 0.58 0.0054  0.016  0.38  0.78
38:  3 160 0.56 0.0055  0.018  0.35  0.76
39:  3 160 0.53 0.0055  0.019  0.33  0.74
40:  3 170 0.51 0.0056  0.021  0.31  0.72
41:  3 180 0.49 0.0056  0.023  0.28  0.69
42:  3 240 0.47 0.0055  0.025  0.26  0.67
43:  3 270 0.44 0.0055  0.028  0.24  0.65
44:  3 270 0.42 0.0054   0.03  0.22  0.62
45:  3 320  0.4 0.0053  0.033   0.2   0.6
46:  3 360 0.38 0.0052  0.037  0.18  0.58
47:  3 390 0.36 0.0051   0.04  0.16  0.55
48:  3 420 0.33 0.0049  0.044  0.14  0.53
49:  3 460 0.31 0.0048  0.049  0.12   0.5
50:  3 470 0.29 0.0046  0.055   0.1  0.47
    cg   t    S     Sv    SCV lower upper
$`1`
      cg    t S  Sv SCV lower upper
  1:   1 1800 1   0   0     1     1
  2:   2 1100 1   0   0     1     1
  3:   3 1600 1   0   0     1     1
  4:   4 1900 1   0   0     1     1
  5:   5 3600 1   0   0     1     1
 ---                               
350: 350 1000 0 NaN NaN   NaN   NaN
351: 350 1400 0 NaN NaN   NaN   NaN
352: 350 2300 1   0   0     1     1
353: 350  220 0 NaN NaN   NaN   NaN
354: 350  850 0 NaN NaN   NaN   NaN

$`2`
    cg    t S  Sv SCV lower upper
 1:  1 1200 0 NaN NaN   NaN   NaN
 2:  2 1400 0 NaN NaN   NaN   NaN
 3:  3  190 0 NaN NaN   NaN   NaN
 4:  4  390 0 NaN NaN   NaN   NaN
 5:  5  140 0 NaN NaN   NaN   NaN
 6:  6  110 0 NaN NaN   NaN   NaN
 7:  7 3400 0 NaN NaN   NaN   NaN
 8:  8  970 0 NaN NaN   NaN   NaN
 9:  9  180 0 NaN NaN   NaN   NaN
10: 10  220 0 NaN NaN   NaN   NaN
11: 11 1300 1   0   0     1     1
12: 12  130 0 NaN NaN   NaN   NaN
13: 13   51 0 NaN NaN   NaN   NaN
14: 14  330 0 NaN NaN   NaN   NaN
15: 15  400 0 NaN NaN   NaN   NaN
16: 16  550 0 NaN NaN   NaN   NaN
17: 17  130 0 NaN NaN   NaN   NaN
18: 18  260 0 NaN NaN   NaN   NaN
19: 19   41 0 NaN NaN   NaN   NaN
20: 20  860 0 NaN NaN   NaN   NaN
    cg    t S  Sv SCV lower upper

$`3`
    cg    t S  Sv SCV lower upper
 1:  1 1000 1   0   0     1     1
 2:  2 4200 1   0   0     1     1
 3:  3  190 0 NaN NaN   NaN   NaN
 4:  4 2100 0 NaN NaN   NaN   NaN
 5:  5 2500 1   0   0     1     1
 6:  6 2700 1   0   0     1     1
 7:  7 1900 1   0   0     1     1
 8:  8  560 0 NaN NaN   NaN   NaN
 9:  9 2200 1   0   0     1     1
10: 10 2400 1   0   0     1     1
11: 11 1400 1   0   0     1     1
12: 12 1300 1   0   0     1     1
13: 13 2600 1   0   0     1     1
14: 14 3000 1   0   0     1     1
15: 15 4000 1   0   0     1     1
16: 16 1200 1   0   0     1     1
17: 17 3600 0 NaN NaN   NaN   NaN
18: 18 1000 0 NaN NaN   NaN   NaN
19: 19 1900 0 NaN NaN   NaN   NaN
20: 20 1200 0 NaN NaN   NaN   NaN
21: 21 1100 1   0   0     1     1
22: 22 1400 1   0   0     1     1
23: 23 1600 0 NaN NaN   NaN   NaN
24: 24  610 0 NaN NaN   NaN   NaN
25: 25 1600 0 NaN NaN   NaN   NaN
26: 26 3300 0 NaN NaN   NaN   NaN
27: 27 3300 1   0   0     1     1
28: 28  760 0 NaN NaN   NaN   NaN
29: 29   94 0 NaN NaN   NaN   NaN
30: 30  600 0 NaN NaN   NaN   NaN
31: 31  800 0 NaN NaN   NaN   NaN
32: 32  350 0 NaN NaN   NaN   NaN
33: 33  460 0 NaN NaN   NaN   NaN
34: 34 1200 0 NaN NaN   NaN   NaN
35: 35  330 0 NaN NaN   NaN   NaN
36: 36  490 0 NaN NaN   NaN   NaN
37: 37  260 0 NaN NaN   NaN   NaN
38: 38 1100 1   0   0     1     1
39: 39   71 0 NaN NaN   NaN   NaN
40: 40 1700 1   0   0     1     1
41: 41 1200 0 NaN NaN   NaN   NaN
42: 42 1200 0 NaN NaN   NaN   NaN
43: 43   77 0 NaN NaN   NaN   NaN
44: 44  940 0 NaN NaN   NaN   NaN
    cg    t S  Sv SCV lower upper

survMisc documentation built on May 2, 2019, 5:14 p.m.