Thank you Jack!
10.11.2013 16:20, Riccardo (Jack) Lucchetti:
<hansl>
set echo off
set messages off
open rac3d.gdt --quiet
list X = SEX INCOME ILLNESS ACTDAYS HSCORE
# Poisson regression
poisson DVISITS 0 X
# Initial OLS to get starting values for the coefficients
series fake_y = ln(DVISITS+1)
ols fake_y 0 X --quiet
list xList = $xlist
matrix b = $coeff
matrix mX = {xList}
mle loglik = DVISITS*Xb - m
series Xb = mX * b
series m = exp(Xb)
series e = DVISITS - m
deriv b = {e} .* mX
end mle --hessian
# Poisson regression with Offset
lAge = ln(AGE)
poisson DVISITS 0 X ; AGE
series fake_y = ln(DVISITS+1) - lAge
mle loglik = DVISITS*Xb - m
series Xb = mX * b
series m = exp(Xb) * AGE
series e = DVISITS - m
deriv b = {e} .* mX
end mle --hessian
</hansl>