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, 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 (Jeff Pitblado, StataCorp LP)
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 <> 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

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
*   For searches and help try:

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