Carlos,
There are likely several problems with your likelihood.  You should check it carefully first before you do any optimization.  It seems to me that you have box constraints on the parameters.  They way you are enforcing them is not correct. I would prefer to use an optimization algorithm that can handle box constraints rather than use artificial mechanisms such as what you are trying to do:
if (r<=0 | alpha<=0 | s<=0 | beta<=0) return (NaN)

Even here, a better approach would be:
if (r<=0 | alpha<=0 | s<=0 | beta<=0) return (-.Machine$double.xmax)

I also notice that you do not use `tx' in your `g' function.  There are likely a number of other issues as well.

You may try the nmkb() function in the "dfoptim" package.  It can handle box constraints and typically tends to perform a bit better than optim's Nelder-Mead for unconstrained problems.

Hope this is helpful,
Ravi

	[[alternative HTML version deleted]]

