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.

# Re: st: Potential bug in Stata 11

 From Babak Oskooei To statalist@hsphsun2.harvard.edu Subject Re: st: Potential bug in Stata 11 Date Wed, 19 May 2010 09:11:59 -0700 (PDT)

```Thanks Phil for attending to my question/problem. I commented out the same, what it might look, redundant code and it works fine.

However, if I change the covariate effect, i.e. 4.159, to 2.079 it works fine without even commenting that piece of code out. Here is the code and Stata 11 output:

**********  Code

clear all
set mem 200m
set obs 10000
set seed 30101
gen x = uniform()
gen y = invnorm(uniform())
gen eta=y*2.079
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
}

************** Output

.         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
8371043  total analysis time at risk, at risk from t =         0
earliest observed entry t =         0
last observed exit t =   3401842
.         stcox y, nohr

failure _d:  d
analysis time _t:  t

Iteration 0:   log likelihood = -82108.928
Iteration 1:   log likelihood = -75222.589
Iteration 2:   log likelihood = -74737.776
Iteration 3:   log likelihood = -74734.026
Iteration 4:   log likelihood = -74734.026
Refining estimates:
Iteration 0:   log likelihood = -74734.026

Cox regression -- no ties

No. of subjects =        10000                     Number of obs   =     10000
No. of failures =        10000
Time at risk    =  8371043.106
LR chi2(1)      =  14749.80
Log likelihood  =   -74734.026                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
_t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |   2.087067   .0193951   107.61   0.000     2.049053     2.12508
------------------------------------------------------------------------------
. }

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

This was part of a larger code in which I will use the X variable that was commeneted out by Phil.

In my opinion, something is not right.

Babak

--- On Wed, 5/19/10, Philip Ender <ender97@gmail.com> wrote:

> From: Philip Ender <ender97@gmail.com>
> Subject: Re: st: Potential bug in Stata 11
> To: statalist@hsphsun2.harvard.edu
> Date: Wednesday, May 19, 2010, 11:53 AM
> Babak Oskooei <babak_cho@yahoo.com>
> wrote:
>
> 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. ....
> --------
>
> Using Stata 11 running on Mac OX 10.6.3, I commented out
> the line that
> generates x like this:
>
> *gen x = uniform()
>
> The code ran fine with these results:
>
> Iteration 0:   log likelihood = -82108.928
> Iteration 1:   log likelihood = -71818.568
> Iteration 2:   log likelihood = -69286.528
> Iteration 3:   log likelihood =
> -69035.66
> Iteration 4:   log likelihood = -69032.801
> Iteration 5:   log likelihood = -69032.627
> Refining estimates:
> Iteration 0:   log likelihood = -69032.613
> Iteration 1:   log likelihood = -69032.613
>
> Cox regression -- no ties
>
> No. of subjects =        10000
>
>    Number of obs   =
>    10000
> No. of failures =        10000
> Time at risk    =   1679070425
>
>
>
>    LR chi2(1)      =
> 26152.63
> Log likelihood  =   -69032.613
>
>    Prob > chi2
>    =    0.0000
>
> ------------------------------------------------------------------------------
>           _t |
> Coef.   Std. Err.      z
>   P>|z|     [95% Conf.
> Interval]
> -------------+----------------------------------------------------------------
>            y
> |   4.177157   .0343322   121.67   0.000
>    4.109867    4.244447
> ------------------------------------------------------------------------------
>
> If the lise is not commented out then I get the same error
> message as Babak.
>
> --
> Phil Ender
> UCLA Statistical Consulting Group
> *
> *   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/
>

*
*   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/
```