On Wed, 26 Oct 2011, Giuseppe Vittucci wrote:
The following code (adapted from the manual):
mle logl = check ? - ln(pstr_cssr(y,X,q,gamma,c,m,Z) : NA
scalar check = (gamma > zeros(r,1)) && (c >= c_min) && (c
<=c_max)
params gamma c
end mle
simply checks that the unconstrained maximum is in the parameter space
and returns an error if it is not so.
But is there a way to find such a constrained maximum in gretl?
If there is not, what is the best way to circumvent the problem?
There isn't. The idea is to check whether the parameters are admissible
when the loglik is computed, just like you're doing.
A couple of tips:
1) I suppose gamma is a vector; you can achieve the same result as what
I think you're tryng to do by writing (gamma > 0) (cool, huh?)
2) if you have constrained parameters, you're probably much better off if
you use some 1-to-1 transformation to some unbounded parameter. In your
example, assuming you really mean to use <= and >= rather than strict
inequalities, you may use
mle logl = ln(pstr_cssr(y,X,q,gamma,c,m,Z)
matrix gamma = exp(lg)
scalar c = c_min + 0.5*(sin(ac) + 1)*c_max
params lg ac
end mle
and then retrieve the $vcv for your original parametrisation by the delta
method. Otherwise, if what you mean is really c_min < c < cmax (more
customary in ml problems), then a nicer alternative is
scalar c = c_min + 0.5*(tanh(ac) + 1)*c_max
or perhaps
scalar c = c_min + cnorm(ac)*c_max
HTH,
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti