Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: pointing to a class member function (likelihood) with optimize() in mata


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: pointing to a class member function (likelihood) with optimize() in mata
Date   Thu, 28 Oct 2010 14:19:02 -0500

Pierre Carl Michaud <pcmichaud@gmail.com> had a follow-up question on using
Mata class programming and -optimize()-:

> Thanks. I think I was working along similar lines although I had not yet
> succeeded. I was thinking of decoupling the model class from the estimation
> class. If I understood correctly, the following could work following what
> you wrote
> 
> class model {
> 	specifies model
> 	provides eval function
> }
> 
> class estimate {
> 	starts an instance of model, say m
> 	sets parameters in m
> 	has the wrapper eval calling m.eval
> 	uses optimize using &eval for formats output, covar, etc
> }
> 
> Is that correct?

The 'eval' function passed to -optimize()- cannot be a member function of a
class.

Pierre will still need to define a wrap-around function that can be accessed
by -optimize()-, this wrap-around function must be defined outside the 'model'
class and 'estimate' class.

In our previous post, the wrap-around function was called -logit_eval()-.

--Jeff					--Hua
jpitblado@stata.com			hpeng@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index