************************************************************************** * This is the likelihood of the Generalized Logistic Model introduced by * * T.A. Stukel (1988), JASA, vol. 83, No. 402, pp. 426-431. * * Author : Gregory Kordas * ************************************************************************** capture program drop stukel program define stukel local lnf "`1'" local Xb "`2'" local Zc "`3'" local gamma "`4'" local delta "`5'" tempvar c quietly { gen double `c'=1 * Xb/Zc >= 0 if `gamma'>0 { replace `c' = (1/`gamma')*(exp(`gamma'*`Xb'/exp(`Zc'))-1) if `Xb'/exp(`Zc')>=0 } else if `gamma'==0 { replace `c' = `Xb'/exp(`Zc') if `Xb'/exp(`Zc')>=0 } else { replace `c' = -(1/`gamma')*log(1-`gamma'*`Xb'/exp(`Zc')) if `Xb'/exp(`Zc')>=0 } * Xb/Zc < 0 if `delta'>0 { replace `c' = -(1/`delta')*(exp(`delta'*(-`Xb'/exp(`Zc')))-1) if `Xb'/exp(`Zc')<0 } else if `delta'==0 { replace `c' = `Xb'/exp(`Zc') if `Xb'/exp(`Zc')<0 } else { replace `c' = (1/`delta')*log(1-`delta'*(-`Xb'/exp(`Zc'))) if `Xb'/exp(`Zc')<0 } quietly replace `lnf' = cond($S_mldepn, -ln(1+exp(-`c')), /* */ -(`c')-ln(1+exp(-`c'))) } end