<hansl>
open poisson.gdt
poisson y 0 x1 x2
series fake_y = ln(y+1)
ols fake_y 0 x1 x2 --quiet
list xList = $xlist
matrix b = $coeff
matrix mX = {xList}
function matrix score(series y, series m, matrix mX)
return {y - m} .* mX
end function
function void Hess(matrix *H, series m, matrix mX)
#computes the negative Hessian for Poisson model
H = mX'(mX .* {m})
end function
matrix H = {}
mle loglik = y*xb - m - lngamma(y+1)
series xb = mX*b
series m = exp(xb)
deriv b = score(y, m, mX)
hessian Hess(&H, m, 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@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users