On Fri, 2011-09-30 at 07:50 +0200, Riccardo (Jack) Lucchetti wrote:
> On Thu, 29 Sep 2011, Giuseppe Vittucci wrote:
> 
> > Hi,
> >
> > I and my colleague are writing a function in gretl to estimate Panel
> > Smooth Transition Regression (PSTR) models and make the related
> > diagnostic tests:
> [...]
> > I thought I could use the mle command with the related log-L:
> > Log-L = - n/2(ln SSR/n + const)
> > where SSR could have been the output of the function
> >
> > The problem is that such function must have vectors as arguments: gamma
> > and c are vectors whose dimension can change, since they depend on the
> > number of regimes and location parameters, in turn determined by the
> > tests or the researcher.
> > So, it seems quite problematic to adapt the mle command.
> 
> I don't see why.
> I guess your best strategy is to define a function like
> 
> function series blah(series y, list X, matrix gamma, matrix c)
> 
> which returns the term inside the double summation in eq (11) and then use 
> that in computing the loglikelihood. 

Yes, I thought it was a workable strategy and possibly it is.
The problem with mle is that mle seems to accept as argument of the
function only scalars (or does it accept also matrices?) and you have to
list in the second line of the command what they are), while the above
function as two vectors as argument.

> Note, however, that
> 
> * you can also use nls: possibly irrelevant, but the estimator you're 
> implementing is a least squares estimator, so it's worth a shot

This was my first choice but it is probably more intricate given the way
the command is defined (nls y = ....) while you have to demean the
series at each step of the iteration.

> * you also have the two function MaxBFGS and MaxNR, which are probably 
> more similar to the stuff you have in matlab; however, those are generic 
> optimisers, whereas yours is an estimation problem proper, so mle gives 
> you all sorts of specialised gadgets you will probably like (eg automatic 
> computation of the vcv matrix)

This will help for sure.

> In short:
> 
> 1) use mle together with a judicious use of functions
> 2) read the fine manual ;-)
> 
> Riccardo (Jack) Lucchetti
> Dipartimento di Economia
> Università

Ok. Thanks a lot.


Reply via email to