Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Potential bug in Stata 11

 From Babak Oskooei To Stata List Subject st: Potential bug in Stata 11 Date Wed, 19 May 2010 07:48:52 -0700 (PDT)

```Dear Stata users,

I have been conducting some simulations in Stata and faced a computational problem in Stata 11. I run the same code in Stata 9 and it gives me the right answer. I would be grateful for any feedback on this. Below, I include the code and the output from both version 9 and version 11. I am simply simulating conditional time-to-event data that are exponentially distributed with one  normally distributed covariate. Then I fitt the Cox PH model to the simulated data.

The code I wrote is:

clear
set mem 200m
set obs 10000
set seed 30101
gen x = uniform()
gen y = invnorm(uniform())
gen eta=y*4.159
gen u=-ln(1-uniform())/0.02   /* exp dist with given hazard */
gen t=exp(-eta)*u
gen d=1

noi{
stset t, failure(d)
stcox y, nohr
}

*********************** Here is the output from Stata 11

.         stset t, failure(d)

failure event:  d != 0 & d < .
obs. time interval:  (0, t]
exit on or before:  failure

------------------------------------------------------------------------------
10000  total obs.
0  exclusions
------------------------------------------------------------------------------
10000  obs. remaining, representing
10000  failures in single record/single failure data
1.28e+11  total analysis time at risk, at risk from t =         0
earliest observed entry t =         0
last observed exit t =  1.25e+11
.         stcox y, nohr

failure _d:  d
analysis time _t:  t

Iteration 0:   log likelihood = -82108.928
Iteration 1:   log likelihood = -71768.287
Iteration 2:   log likelihood = -70067.991
Iteration 3:   log likelihood = -69325.489
Iteration 4:   log likelihood = -68942.115
flat region resulting in a missing likelihood
r(430);
. }
r(430);

*********************** Here is the output from Stata 9

.         stset t, failure(d)

failure event:  d != 0 & d < .
obs. time interval:  (0, t]
exit on or before:  failure

------------------------------------------------------------------------------
10000  total obs.
0  exclusions
------------------------------------------------------------------------------
10000  obs. remaining, representing
10000  failures in single record/single failure data
1.28e+11  total analysis time at risk, at risk from t =         0
earliest observed entry t =         0
last observed exit t =  1.25e+11
r; t=0.11 15:37:08
.         stcox y, nohr

failure _d:  d
analysis time _t:  t

Iteration 0:   log likelihood = -82108.928
Iteration 1:   log likelihood = -71768.287
Iteration 2:   log likelihood = -70067.991
Iteration 3:   log likelihood = -69325.489
Iteration 4:   log likelihood = -68942.115
Refining estimates:
Iteration 0:   log likelihood = -68932.661
Iteration 1:   log likelihood = -68928.827
Iteration 2:   log likelihood = -68928.826

Cox regression -- no ties

No. of subjects =        10000                     Number of obs   =     10000
No. of failures =        10000
Time at risk    =  1.28362e+11
LR chi2(1)      =  26360.20
Log likelihood  =   -68928.826                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
_t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |   4.183923   .0341413   122.55   0.000     4.117007    4.250838
------------------------------------------------------------------------------
r; t=0.20 15:37:08
. }
r; t=0.33 15:37:08

***********************

I would be grateful if someone could help me to find out what the problem is.

Kind regards

Babak Oskooei
MRC Clinical Trial Unit
London

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