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. 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
* 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)
In short:
1) use mle together with a judicious use of functions
2) read the fine manual ;-)
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti