Good afternoon.
I am running maximum likelihood using the script window.
I have the need to estimate a log-likelihood that has a different 
functional form depending on whether the estimated value of the 
variable(the residual) at each observation is lower or greater than zero.
In generic terms
if u_i <=0
mle   logl_i = f(u_i, a, b)
else
mle   logl_i = g(u_i, a, b)
endif
where u_i = y_i - c0 - c1*x_1i - c_2*x_2i     and the coefficients c0, 
c1, c2 are also under estimation, together with the variance terms a,b
I am not sure how to write the mle command for this case.
Since the value of the residual is itself under estimation (and so the 
condition to switch functional forms is not pre-determined), I am not 
even sure if this is feasible (starting values are of course provided 
for the coefficients).
At worst, I could estimate the coefficients for the regressors by LS, 
and thus create the residual series beforehand, and then plug it in and 
let the mle calculate only the variance terms (which are my focus of 
interest). But even in this case I don't seem to be able to write 
correctly the IF-ELSE statement that apparently is needed. Naturally, I 
would prefer to have the joint estimation procedure.
Any help will be really appreciated.
-- 
Alecos Papadopoulos
Athens University of Economics and Business, Greece
Department of Economics
cell:+30-6945-378680
fax: +30-210-8259763
skype:alecos.papadopoulos