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

# RE:st: confidence intervals of predicted risk after stcox

 From petretta@unina.it To statalist@hsphsun2.harvard.edu Subject RE:st: confidence intervals of predicted risk after stcox Date Sat, 27 Oct 2012 12:10:52 +0200

```Many thanks to Steve Samuels for the replay.

My problems are:

```
1. If I gen survival probability and not risk, the upper and lower limits of CI seem inverted:
```
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

Where is my mistake?

Mario Petretta
Dpt. of Internal Medicine, Cardiology and Heart Surgery
Naples University Federico II -Italy

--------------------------------------------

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?

Steve

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
estimate.

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.

Mario Petretta
Dpt. of Internal Medicine, Cardiology and Heart Surgery
Naples University Federico II -Italy

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```