Sheldon,
try something like this and remember
that your function only gets one vector
of parameters from optim. So you have to
disentangle them within your function...
optim.out <-
optim(par=c(1,1),fn=nb.loglik,y=y,method="BFGS",
control=list(fnscale=-1,trace=1,REPORT=1),hessian=T)
Holger
Sheldon Bond wrote:
Greetings,
I am having a similar problem with the optimization of my negative
binomial function. It does not seem to recognize that I have two
parameter. I have given it a vector of two values, but it keeps telling
me a parameter is missing. Any thoughts?
Regards,
Sheldon
On 3/15/06, *Juan Vargas* <jfvargas(a)fas.harvard.edu
<mailto:jfvargas@fas.harvard.edu>> wrote:
Anna,
you can't set the value of sigma^2 to 1 because some log in your
likelihood function is going to be the log of zero (sigma^2 minus
one). So try a different initial value >1
Juan
On 3/15/2006 8:57 PM, anna nyiry wrote:
i have the R function for the loglikelihood.
i put it in the optim
and gives me the following error. Why??
(about the par in the optim. Should it be a vector as i have it??
one value for phi and one for sigma??)
Error in optim(par =c(1,1), fn = negbinom.loglik, N = 10, y = y1,
method = "BFGS", :
initial value in 'vmmin' is not finite
*/Dan Hopkins <dhopkins(a)fas.harvard.edu>
<mailto:dhopkins@fas.harvard.edu>/* wrote:
The negative binomial integrates over lambda, so you shouldn't
need to
worry about it. Best, Dan
----
Ph.D. Student
Department of Government
Harvard University
Tutor, Currier House
dhopkins(a)fas.harvard.edu <mailto:dhopkins@fas.harvard.edu>
http://www.danhopkins.org <http://www.danhopkins.org/>
On Wed, 15 Mar 2006, anna nyiry wrote:
Ian,
in 3.3 what should we do with lambda? sh! ould we give to it a
sequence
of numbers or a single value??
Anna
Ian Brett Yohai wrote:
I would check your pois.loglike function - it should return
only one
number (the value of the log likelihood).
Best,
Ian
On Wed, 15 Mar 2006, anna nyiry wrote:
> hey
>
> I used this function (like you have in the section notes)
> par=5 because the maximum is around that area
> N2 is a rep(5,10)
> y1 is the y you give in the assignment
>
>
optim(par=5,fn=pois.loglik,N=N1,y=y1,method="BFGS",control=list(fnscale=-1,trace=1,REPORT=1),hessian=T)
>
> It gives me the following error message
>
> Error in optim(par = 5, fn = pois.loglik, N = N1, y = y1,
method =
"BFGS", :
> objective function in optim evaluates to
length 10 not 1
>
> Ian Brett Yohai wrote:
> Hi Anna,
>
> It's helpful if you provide the error message you are
getting
so we can
> diagnose the problem.
>
> Best,
> Ian
>
> On Wed, 15 Mar 2006, anna nyiry wrote:
>
> > hi list,
> >
> > I have written the function for the Poisson log likelyhood.
> > I am trying to find the MLE but I cannot make optim work
(as it
is provided in the section notes) ... any ideas why not?
> >
> >
> > "Michael J. A. Berry" wrote:
> > st1\:*{behavior:url(#default#ieooui) } I hope this is not
considered an abuse of the class list.
> >
> > Most summers I hire one or two people as "summer interns."
These have usually been graduate students in some analytical
field. People in this class would have the right ! skills,
though perhaps not the right interests.
> >
> > The data we analyze is typically marketing related.
Examples
include forecasting how many active subscribers an ISP
or phone company will have each day for the next two years;
Figuring out which towns should be grouped together for the
Boston Globe's local content editions; and selecting good places
for an insurance company to open new offices. In addition to
data analysis there would probably be work developing and
debugging exercises for a series of 3-day classes we are
developing and perhaps some general-purpose data preparation and
programming.
> >
> > This being the business world, knowledge of the tools our
clients use such as SAS and SQL would be better than R and
LaTex, but this is not a big concern. Our office is in the North
End close to North Station and the Haymarket stop of the Orange
and Green lines.
> > See
www.data-miners.com
<http://www.data-miners.com/> for
more information.
> >
> > If interested, please be careful to respond only to me (
mjab(a)data-miners.com <mailto:mjab@data-miners.com>) so as not to
bother the whole list.
> >
> > -Michael
> >
> > ===============
> > Michael J. A. Berry
> > Data Miners, Inc.
> > +1 617 742 4252
> >
> >
> > _______________________________________________
> > gov2001-l mailing list
> > gov2001-l(a)lists.fas.harvard.edu
<mailto:gov2001-l@lists.fas.harvard.edu>
> >
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
> >
> >
> >
> > ---------------------------------
> > Yahoo! Mail
> > Use Photomail to share photos without annoying attachments.
> _______________________________________________
> gov2001-l mailing list
> gov2001-l(a)lists.fas.harvard.edu
<mailto:gov2001-l@lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
---------------------------------
Yahoo! Travel
Find great deals to the top 10 hottest destinations!
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
<mailto:gov2001-l@lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
<mailto:gov2001-l@lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
------------------------------------------------------------------------
Yahoo! Mail
Use Photomail
<http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=38867/*http://photomail.mail.yahoo.com>
to share photos without annoying attachments.
------------------------------------------------------------------------
_______________________________________________ gov2001-l mailing
list gov2001-l(a)lists.fas.harvard.edu
<mailto:gov2001-l@lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
<http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l>
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu <mailto:gov2001-l@lists.fas.harvard.edu>
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
------------------------------------------------------------------------
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
--
Holger Lutz Kern
Graduate Student
Department of Government
Cornell University
Institute for Quantitative Social Science
Harvard University
1737 Cambridge Street N350
Cambridge, MA 02138