Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: d0 and Log-logistic hazard


From   <alfonsomirand4@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: d0 and Log-logistic hazard
Date   Tue, 27 Aug 2002 10:13:06 -0700 (PDT)

I am trying to write a d0 maximum likelihood code for
estimating a split-population duration model with
gamma unobserved individual heterogeneity and
log-logistic hazard. The estimation strategy finds
first initial values from streg and set the initial
probability of never fail to 2%. Then the ml code is
used. I already checked that my log-likelihood is
correctly written and the ml check is ok. But still
Stata finds that the log-likelihood function is not
concave and does not converges. Having this in mid,
and in the spirit to find my potential mistake, I
tried to create a d0 code for the standard duration
model with gamma unobserved individual heterogeneity
from lloghet_glf. Basically I did no changes to the
code but take away the part that refers to d1 and d2
methods. Running this alternative program I learned
that Stata does the same: it keeps saying that the
log-likelihood function is not concave and it does not
converges. Hence, it seems that the problem is not in
the d0 code. Why is this is happening? Is it that a d1
(or maybe a d2) method is required whenever a
log-logistic model is to be estimated? 


Could you give me some hint on what further action
should I take?

I sending to you a do file with the simplified version
of the lloghet_glf code so that you can see what is my
problem.

Thank you,

ALFONSO MIRANDA
University of Warwick
 

-----------------Do-File------------------------------
use http://www.stata-press.com/data/r7/cancer, clear
set more off
stset studytime, fail(died)
streg drug age, d(logl) 
matrix B0 = e(b)
matrix cr = -1
matrix colnames cr = ln_the:_cons
matrix B1=(B0,cr)
capture program drop loglgaspl_ll
program define loglgaspl_ll
version 7
args todo b lnf 
tempvar beta lngamma lntheta 
mleval `beta' = `b', eq(1)
mleval `lngamma' = `b', eq(2) scalar 
mleval `lntheta' = `b', eq(3) scalar
local t = _t 
local d = _d
 
quietly {
scalar `lngamma'=cond(`lngamma'<-20,-20,`lngamma')
scalar `lntheta'=cond(`lntheta'<-20,-20,`lntheta')
tempname th ga
tempvar a b c 
 
scalar `ga' = exp(-`lngamma') /* gamma really 1/gamma
*/
scalar `th' = exp(`lntheta')
 
gen double `a' = 1/`th'+`d' if $ML_samp
gen double `b' = 1+(`t'*exp(-`beta'))^`ga' if $ML_samp
gen double `c' = ln(1+`th'*ln(`b')) if $ML_samp 
 
mlsum `lnf' = -`a'*`c' + `d'*(`ga'*(ln(`t') - /*
*/ `beta') - `lngamma' - ln(`b'))
if `todo'==0 | `lnf'==. { exit }
}
end 
ml model d0 loglgaspl_ll (_t: _t = drug age) (ln_gam:)
(ln_the:) 
ml init B1
ml maximize, search(off)
exit
-----------------------------------------------------

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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