Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ML varlist definition


From   "[iso-8859-7] ��������� ���������" <[email protected]>
To   [email protected]
Subject   st: ML varlist definition
Date   Mon, 3 Mar 2008 08:32:29 +0200 (EET)

Hi to the list,
I try to run the following .do program using ML command:
*** initial estimates ****
cloglog dead drug age logt , nocons
tempname tempname b0 cpr b1 v0
matrix b0=e(b)
matrix v0=e(V)
matrix coleq b0= hazard
matrix cpr= -4
matrix colnames cpr=cure
matrix b1 =b0,cpr

program define spsurv_7
         args todo b lnf
         tempvar t1 t2 sum ST ST_1 ht hT I1 I2 last c
         mleval `I1' = `b', eq(1)
         mleval `I2' = `b', scalar eq(2)
         quietly {

         ge double `c' = 1/(1+exp(-`I2'))
         ge double `ht' = 1-exp(-exp(`I1'))
         by $S_MLE_id: ge double `sum' = exp(sum(ln(1-`ht')))
         by $S_MLE_id: ge double `ST' = `sum'[_N] if _n==N
         by $S_MLE_id: ge double `ST_1' = cond(_N==1,1, cond(_n==_N &
_N>1,`sum'[_N-1],.))
         by $S_MLE_id: ge double `hT' = `ht'[_N] if _n==_N
         by $S_MLE_id: ge byte `last' = 1 if _n==_N


         mlsum `lnf' = cond($ML_y1,(ln(1-`c')+ln(`hT')+ln(`ST_1')), /*
                         */ ln(`c'+(1-`c')*`ST')) if `last'==1

         if `lnf' ==.  {exit}
         }
 end
ml model d0 spsurv_7 ( hazard: dead= drug age logt,nocons) (cure:) ,
init(b1,skip)

and I get the error message r(100) varlist is not defined.
 I supose  that is true because S_MLE_id is not defined . How can solve it
thanks a lot
D.Lalountas




*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index