...Thank you very much! It does indeed work and I confirmed it using Zelig.
Johannes
Quoting "Dragojevic, Mila" <Mila_Dragojevic at brown.edu>:
Johannes,
this should work:
ll.logit <- function(par, x, y) {
beta<- par[1:ncol(x)]
out<- -sum(log(1+ exp((1-2*y)*x%*%beta)))
return(out)
}
________________________________
From: gov2001-l-bounces at
lists.fas.harvard.edu on behalf of Johannes Castner
Sent: Sat 3/15/2008 18:55
To: gov2001-l at
lists.fas.harvard.edu
Subject: Re: [gov2001-l] problems with logit log likelihood
Here is my version of this function and optim gives me rather bazar answers:
ll.logit <- function(par, x, y) {
beta<- par[1:ncol(x)] # we must create a constant term and include that in
the
matrix "x"
-sum(log(1+ exp((1-2*y)%*%x%*%beta)))}
If someone has an idea why, I would truely appreciate any comments.
Johannes
Quoting Keith Schnakenberg <keith.schnakenberg at gmail.com>:
That is a good point, but does not actually fix
the problem. Also,
when I change the percentage signs, optim() tells me something about
non-finite finite-difference values.
Thanks,
Keith
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l