Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[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   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
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 <[email protected]> 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
[email protected]			[email protected]
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index