Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Re: st: confidence intervals of predicted risk after stcox

From   Steve Samuels <>
Subject   Re:Re: st: confidence intervals of predicted risk after stcox
Date   Wed, 31 Oct 2012 10:21:49 +0100
Date   Tue, 30 Oct 2012 16:09:05 -0400

Many thanks to Steve Samuels for the explanation.
I apologize for the previous private replay.

Mario wrote to me privately. When this happens I refer the writer to the
FAQ paragraph that starts "Do not request private replies...".

My problems are:

1. If i gen survival probability and not risk, the upper and lower
limits of ci seem inverted:

They should be inverted. You previously computed CIs for the failure ("risk") curve, now you are computing the CIs for the survival curve. A high risk for failure implies a low risk for survival and vice-versa. This is mathematically so because F = 1 -S, as you
previously calculated. Thus the upper and lower limits for the two curves are

[Show Quoted Text - 33 lines][Nascondi Testo quotato]
Gen survlb15 = base15^exp(lb)
gen survub15 = base15^exp(ub)
gen surv15 = base15^exp(xb)
sum survlb15 surv15 survub15

    variable |       obs        mean    std. Dev.       Min        max
    survlb15 |        48    .7716674    .2110915    .381534   .9887756
      surv15 |        48    .5276728     .343838   .0012602   .9593767
    survub15 |        48    .2910488    .3057171   8.11e-21   .8586743

2. To compare the survival result at 15 months obtained in subjects
with age40 = 20 and drug = 3, i used the stata command survci
(-survci- sj11-4: St0217_1 ? Initially written by yulia marchenko of
statacorp  and thereafter adjourned by matthew cefalu (the stata
journal (2011), number  1, pp. 64?81 pointwise confidence intervals
for the covariate-adjusted survivor function in the cox model).

The code i used is:
Survci, at(age40=20 drug=3) outfile(age20_drug3).

The results of survci at 15 months are:
_t     _d        _surv       _se          _lb                _ub
15     1        .85324285   .07846486   .6101214      .95029744

those of my code are the same as regard surv15 but very different as
regard the confidence intervals (lower and upper)

surv15             survlb15              survub15
.8532429          .9722255                4089079

There are two mistakes here.
1. The minor one is that the -survci- gives CIs for someone
with   with age = 20 and drug = 3, whereas the *15 values
you show are averages over the entire sample. There's no
reason to expect similarity.

2. The major mistake is that your original CIs reflect only variability of
the estimated betas, whereas -survci-  properly takes into account the fact
that the baseline survival probability is also an estimate.


[Show Quoted Text - 59 lines][Nascondi Testo quotato]

date: Fri, 26 oct 2012 17:15:04 -0400
from: Steve samuels <sjsamuels@gmail.Com>
subject: Re: St: Confidence intervals of predicted risk after stcox

mario, when i run your code, and sum the new variables, i get:

Variable |       obs        mean    std. Dev.       Min        max
- -------------+--------------------------------------------------------
        lb15 |        48    .2283326    .2110915   .0112244   .6184661
      risk15 |        48    .4723272     .343838   .0406233   .9987398
        ub15 |        48    .7089512    .3057171   .1413257          1

i see nothing strange about them. What is it that does not make sense to you?


on oct 26, 2012, at 6:45 am, petretta@unina.It wrote:

Hi all,

i use stata/ic 12.1 for windows (32-bit).

I run a cox model to calculate for each patient the predicted probability
of event at 15 months, using predict xb, predict basesurv and adjiusting
the baseline risk

webuse cancer, clear
gen age40=age-40
stcox age40 i.Drug
predict xb, xb
predict basesurv, basesurv
sum basesurv if _t<16
scalar base15 = r(min)
gen risk15 = 1 - base15^exp(xb)

i ask if it is possible to have also the 95% confidence intervals of these

I try:

Predict se_xb, stdp
gen lb = xb - invnormal(0.975)*se_xb
gen ub = xb + invnormal(0.975)*se_xb
gen lb15 = 1 - base15^exp(lb)
gen ub15 = 1 - base15^exp(ub)

but the results seems do not have sense.

Thanks for your consideration.

Mario petretta
dpt. of internal medicine, cardiology and heart surgery
naples university federico ii -italy

Mario, when I run your code, and sum the new variables, I get:

Variable |       Obs        Mean    Std. Dev.       Min        Max
- -------------+--------------------------------------------------------
       lb15 |        48    .2283326    .2110915   .0112244   .6184661
     risk15 |        48    .4723272     .343838   .0406233   .9987398
       ub15 |        48    .7089512    .3057171   .1413257          1

I see nothing strange about them. What is it that does not make sense to you?

*   For searches and help try:

Mario Petretta
Dipartimento di Medicina Clinica Scienze Cardiovascolari e Immunologiche
Facoltà di Medicina e Chirurgia
Università di Napoli Federico II
081 - 7462233

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index