Statalist


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

st: streg


From   "mujde erten" <mujde.erten@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: streg
Date   Mon, 3 Nov 2008 22:33:31 -0500

Hi all,

 I am trying to learn how to use streg for generalized gamma
estimation. So far i  have been unsuccessful in doing so because i am
 unable to get convergent solution. My question to you all is whether
i am missing smt out while invoking streg or using it improperly.
Below i have attached the small piece of code i have been working
with. It tries to generate log normal data and then tries to fit
generalized gamma model to it. (lognormal is a special case of
generalized gamma)

 Please have a look at it. Thanks in advance.

  set obs 10000
 obs was 0, now 10000

 . set seed 753

 . gen x = 2*uniform()

 . quietly summ x

 . local meanx r(mean)

 . gen e1 = invnormal(uniform())

 . gen e2 = 2*invnormal(uniform())

 . local b01 = ln(1)- `meanx' - 0.5*1

 . local b02 = ln(1)- `meanx' - 0.5*2

 . forvalues i = 1/2 {
  2.         gen y`i' = exp(`b0`i'' + x + e`i')
  3. }

 . forvalues j = 1/2 {
  2.         stset y`j'
  3.         streg y`j' x, d(gamma) robust skip difficult nonrtolerance
  4.         matrix beta`j' = e(b)
  5.         matrix stdev`j' = vecdiag(e(V))
  6. }

     failure event:  (assumed to fail at time=y1)
 obs. time interval:  (0, y1]
  exit on or before:  failure

 ------------------------------------------------------------------------------
    10000  total obs.
        0  exclusions
 ------------------------------------------------------------------------------
    10000  obs. remaining, representing
    10000  failures in single record/single failure data
  11958.73  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =  56.57502

         failure _d:  1 (meaning all fail)
   analysis time _t:  y1

 Iteration 0:   log pseudolikelihood = -21029.662  (not concave)
 Iteration 1:   log pseudolikelihood = -17755.326  (not concave)
 Iteration 2:   log pseudolikelihood = -11915.691  (not concave)
 Iteration 3:   log pseudolikelihood = -9081.0115
 Iteration 4:   log pseudolikelihood = -7834.9916
 discontinuous region encountered
 cannot compute an improvement
 r(430);

 end of do-file

 r(430);
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index