*! version 2.0 10Dec1997
program define cnpoislf
        local lnf "`1'"
        local I "`2'"
        local censor="$S_cen"
        local depvar="$S_mldepn"
        if "$S_mloff" != "" {
		tempvar Io
		qui gen double `Io' = `I' + $S_mloff
	}
	else    local Io "`I'"

        quietly replace `lnf'=cond(`censor'==1, /*
        */ -exp(`Io')+`depvar'*`Io' -lngamma(`depvar'+1), /*
        */ ln(gammap(`depvar',exp(`Io'))))
        qui replace `lnf' = ln(1-gammap(`depvar'+1,exp(`Io'))) if `censor'==-1
end

*  1 = not censored
*  0 = left censored
* -1 = right censored