I found the mistake -- was missing an exp() in my
function. Thanks for
the suggestions.
Matt
Sana Nourani wrote:
Hey Matt,
What's your log-likelihood function? I got the same error message, until
I put the equation for the log-likelihood all on one line. (Something to
do with rounding?)
Best,
Sana
On 4/11/07, *Matt Chingos* <chingos at
fas.harvard.edu
<mailto:chingos at fas.harvard.edu>
<mailto:chingos at fas.harvard.edu>> wrote:
My optim() function appears to be getting most of the way before it
quits with a "non-finite finite-difference value" error message. Any
ideas?
res2 <- optim(par=c(rep(2,ncol(X)+1)), fn =
negbin.ll , method =
"BFGS", lower = -Inf, upper = Inf,
+ control = list(fnscale = -1, trace = 1, REPORT = 1), y = y, X = X,
hessian=T)
initial value 3825.883917
iter 2 value 3070.049345
iter 3 value 2257.365356
iter 4 value 1342.955268
iter 5 value 1136.816221
iter 6 value 928.124126
iter 7 value 606.046863
iter 8 value 603.483548
iter 9 value 602.867409
iter 10 value 599.973412
iter 11 value 593.069402
iter 12 value 590.469328
iter 13 value 580.699935
iter 14 value 571.674717
iter 15 value 570.774623
iter 16 value 547.129119
iter 17 value 545.433919
iter 18 value 540.568033
iter 19 value 539.096883
iter 20 value 536.156018
iter 21 value 534.616860
iter 22 value 532.889720
iter 23 value 530.834047
iter 24 value 530.333352
iter 25 value 529.790616
iter 26 value 529.180387
iter 27 value 529.037447
Error in optim(par = c(rep(2, ncol(X) + 1)), fn = negbin.ll, method =
"BFGS", :
non-finite finite-difference value [4]
Justin Ryan Grimmer wrote:
Hey Maya,
Looking at your start values, you have no. of indep variable 0's
(which
is
something like 7 0's in this example).
Don't forget there is one
extra
paramter, a disperion parameter that needs a
starting value as
well, so
try
par=rep(0, (ncol(indep) + 1))
cheers!
Justin
On Wed, 11 Apr 2007, Katy Backes Kozhimannil wrote:
> Hi Maya,
>
> I got the same message when I started with zeros as start values
for the
> parameters with the negative binomial, as
that causes the
denominatory of the
> likelihood to be zero. I was able to run
mine with a starting
value of 2 for
> all parameters.
>
> Hope this helps!
>
> Katy
>
> On 4/11/2007 1:16 PM, mastrangelo, paolo wrote:
>
>> in my understanding, vmmin complains when it has to compare
infinite
values.
>> So I think you either have a problem with
your function or your
zero starting
>> values.
>> that's all i can come up with!
>>
>>
>>
>> -----Original Message-----
>> From: gov2001-l-bounces at
lists.fas.harvard.edu
>> <mailto:gov2001-l-bounces at lists.fas.harvard.edu>
<mailto:gov2001-l-bounces at lists.fas.harvard.edu> on behalf of
Maya Sen
>> Sent: Wed 4/11/2007 1:00 PM
>> To: gov2001-l at
lists.fas.harvard.edu
>> <mailto:gov2001-l at lists.fas.harvard.edu>
<mailto:gov2001-l
at lists.fas.harvard.edu>
>> Subject: [gov2001-l] error message with
optim
>>
>> Hi everyone,
>>
>> I'm struggling with the negative binomial from part 2.
Basically,
I have a
>> function, which I'm pretty sure is
okay (or at least close to
okay). When I
>> run optim using the following specs,
however, I get the
following error
>> message:
>>
>>
>>
>>> optim.negbin <- optim(par = rep(0, ncol(indep)), fn =
negative.binary,
>>>
>>>
>> method = "BFGS", control = list(fnscale = -1, trace = 1, REPORT
= 1), y =
>> pset7$groups, X = indep, hessian = TRUE)
>> Error in optim(par = rep(0, ncol(indep)), fn = negative.binary,
method
=
>> "BFGS", :
>> initial value in 'vmmin' is not finite
>>
>> I've tried several combinations and nothing seems to work. The same
>> configuration works when I run it using my poisson function in
part
#1. Is
>> this basically telling me that my
function is wrong?
>>
>> thanks for any help in deciphering this error message,
>> Maya
>>
>>
>>
>>
------------------------------------------------------------------------
>>
>> _______________________________________________
>> gov2001-l mailing list
>> gov2001-l at
lists.fas.harvard.edu
>> <mailto:gov2001-l at lists.fas.harvard.edu>
<mailto:gov2001-l
at lists.fas.harvard.edu>
>>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>>
>>
> --
> Katy Backes Kozhimannil, M.P.A.
> Ph.D. Program in Health Policy
> Resident Tutor, Adams House
> Harvard University
>
> 474 Adams Mail Center Cambridge, MA 02138
kbackes at
fas.harvard.edu
<mailto:kbackes at fas.harvard.edu>
>
>
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu <mailto:gov2001-l at lists.fas.harvard.edu>
<mailto:gov2001-l at lists.fas.harvard.edu>
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
<mailto: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 <mailto:gov2001-l at lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l at