It's not yet working (correct) but I think I'm on the right track, or?!
<hansl>
function scalar FEpoisson_ll (matrix beta,
bundle *b)
matrix mX = b["mX"]
matrix mY = b["my"]
scalar LL = 0
matrix g = zeros(rows(beta),1)
scalar count = b["count"]
matrix alphas = ones(b["count"],1)
matrix Ti = b["Ti"]
# the log-likelihood contribution for each i = [1,N]
scalar t1 = 1
loop i=1..count --quiet
scalar t2 = t1 + Ti[i] - 1
scalar sumEXb = sumc(exp(mX[t1:t2, ]*beta))
scalar sumY = sumc(mY[t1:t2, ])
scalar sumYXB = sumc(mY[t1:t2, ]*(mX[t1:t2, ]*beta))
scalar sumYX = sumc(mY[t1:t2, ]*(mX[t1:t2, ]))
alphas[i] = sumY/sumEXb
# here derivative
scalar e = -alphas[i]*sumc(exp(mX[t1:t2, ]*beta).*mX[t1:t2, ]) +
sumYX
LL += -alphas[i] * sumEXb + ln(alphas[i])*sumY + sumYXB
g += e
t1 = t2+1
endloop
b["score"] = g
return LL
end function
<hansl>
12.11.2013 18:30, Pindar:
So, after reading the appropriate literature I now know, that in
principle Poisson FE could be estimated by just including the unit
dummies.
However, there are too many of them in my data set and now I'm stuck
with implementing this log-likelihood
$\sum _{ i=1 }^{ N }{ \left[ -{ \alpha }_{ i }\sum _{ t=1 }^{ T }{ {
\lambda }_{ it }+ } \ln { \left( { \alpha }_{ i } \right) } \sum _{
t=1 }^{ T }{ { y }_{ it }+ } \sum _{ t=1 }^{ T }{ { y }_{ it }\ln {
\left( { \lambda }_{ it } \right) } } \right] }$
I think it wont work with 'mle' because of the 'within sums over t
periods' and needs an approach like in felogit.
Hints?
06.11.2013 11:54, Riccardo (Jack) Lucchetti:
> On Wed, 6 Nov 2013, Pindar wrote:
>
>> I found Jack's felogit.gfn on the server. I guess there is no
>> feprobit because of the incidental parameters problem, or?
>
> Yes. Moreover, if you have a panel dataset you can use the
> --random-effects options to the probit command to obtain RE probit
> estimation via Gaussian quadrature. By the way, your post made me
> realise this is still undocumented, although it's been in for a while
> and I've even used it in a paper! I'll try to update the docs asap.
>
> -------------------------------------------------------
> 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
> -------------------------------------------------------
>
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
>
http://lists.wfu.edu/mailman/listinfo/gretl-users