On Sun, 10 Nov 2013, Pindar wrote:
Hi,
I'd like to replicate the coefficients obtained by 'poisson ; offset' with
MLE statements.
Here is an example that shows the differences.
Btw, is there a more efficient way of coding the MLE e.g. in case of 20
regressors?
<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>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------