Bookmark and Share

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


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

st: ML doubt


From   "Amparo Nagore Garcia" <[email protected]>
To   [email protected]
Subject   st: ML doubt
Date   Tue, 05 Nov 2013 20:11:41 +0100

Dear Statalist,

I have created a program to compute the Maximum likelihood for a Duration model. When I do ml check (after ml init), I receive the next message. It is attached the program. Please, any help is appreciated. (there are no missing values)

"The initial values are not feasible.  This may be because the initial values
have been chosen poorly or because there is an error in CR_stable and it
always returns missing no matter what the parameter values.

Stata is going to search for a feasible set of initial values.
If CR_stable is broken, this will not work and you will have to press Break to
stop the search."

capture program drop CR_stable 
program CR_stable
version 11.2
args todo b lnf 
tempvar beta1
mleval `beta1'=`b', eq(1)
local dt0_1="$ML_y1"
local dt1_1="$ML_y2"
local d1="$ML_y3"
tempvar inthaz1 last  p1
tempvar sumb1
sort contadorbis
by contadorbis: gen double `sumb1'=sum(`d1'*`beta1') if id_05==1
tempvar haz1 
by contadorbis: gen double `haz1'=exp(`sumb1'[_N]) if id_05==1

by contadorbis: gen double `inthaz1'=sum(exp(`beta1'*(`dt1_1'-`dt0_1'))) if id_05==1

by contadorbis: gen double `p1'= `haz1'*exp(-`inthaz1'[_N]) if id_05==1

by contadorbis: gen byte `last'=(_n==_N) 
mlsum `lnf'= ln(`p1') if `last'==1 

end


ml model d0 CR_stable ///
(cr_05_stable: t0_s t_s d_s= $personal,nocons) 

ml init -3.7 0.117	0.142	0.003	0.028	0.006	-0.11	-0.25	-0.07	0.208	0.320	0.328	0.346	0.360	0.343	-0.58	0.125, copy
ml check

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index