Hi,

for the standard Poisson model I'd like to explore different methods of covariance estimation.
Could  you please tell me how to replicate the --hessian flag with the 'Hess' function?
(it's not included in MLE-advanced.inp, I read in the manuel 'negative inverse of the hessian', but I make something wrong since invpd(h) does not do the job).

Have a nice weekend
Leon

<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(matrix b, series y, matrix mX)
    series e = y - exp(mX'b)
    return {e} .* mX'
end function

function void Hess(matrix *H, matrix b, series y, matrix mX)
    #computes the negative Hessian for Poisson model,
    H = -(qform(mX, (mX'b)*(mX'b)'))
end function

matrix H = {}
mle loglik = y*Xb - exp(Xb)
    series Xb = mX'b
    deriv b = score(b, y, mX)
    hessian Hess(&H, b, y, mX)
end mle

# How to replicate --hessian with the 'Hess' function ?
mle loglik = y*Xb - exp(Xb)
    series Xb = mX'b
    deriv b = score(b, y, mX)
end mle --hessian
<hansl>