Instead of Lambda%*%t(y) try an elementwise multiplication. Result should be
n by 1. You get the betas out as usual. The betas are the parms from optim
that max the likelihood.
j.
-----Original Message-----
From: gov2001-l-bounces at
lists.fas.harvard.edu [mailto:gov2001-l-
bounces at
lists.fas.harvard.edu] On Behalf Of Jon Bischof
Sent: Sunday, April 13, 2008 4:35 PM
To: gov2001-l at
lists.fas.harvard.edu
Subject: [gov2001-l] poisson log-likelihood
Hey all,
I'm having trouble with the log-likelihood for the poisson
distribution. Gary's book says that the LL function is:
lambda <- X%*%par
out <- sum((lambda%*%t(y))-exp(lambda))
However, lambda*y is a nxn matrix and exp(lamda) is a nx1 matrix, so
they cannot be subtracted. Furthermore, we want in the end a kx1
matrix of betas, and there is no k length dimension in either of these
matrices. Clearly I have somehow misinterpreted the slides, but I'm
not sure how. Any ideas for getting out the betas?
--
Jon Bischof
Graduate Student
Department of Government
Harvard University
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l