Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: stochastic frontier MLE command - new distribution of error terms

From   Konstantin Hahlbrock <>
Subject   st: stochastic frontier MLE command - new distribution of error terms
Date   Tue, 21 Jun 2011 14:42:24 +0200

Dear all,


I have a question concerning a log Likelihoodfunktion, I want to maximize.


Production function looks as follows


Epsilon=(y-f(x))/g(x) = v-h(x)u, with h(x)=q(x)/g(x)

V ~ N(0,1) and  u ~N+(0,sigma_u)


The log-Likelihoodfunction looks as follows:

Ln L = constant-ln(lambda*g(x)) +ln(Phi(-epsilon*lambda/sigma))-(epsilon^2/sigma^2)



lambda= h(x)*sigma_u



I wrote the following stata-code


program define ml_distribution               


                args todo b lnf

                tempvar fx gx qx su2

                mleval `fx'=`b',  eq(1)    

               mleval `gx'=`b',  eq(2)    

               mleval `qx'=`b',  eq(3)   

               mleval `su2'=`b',  eq(4) 


               tempvar hx lambda sigma

                qui gen double `hx'=(`qx'/`gx')

                qui gen double `sigma'=sqrt(1+`hx'^2*`su2')

               qui gen double `lambda'=`hx'*sqrt(`su2')

                mlsum `lnf'=-0.5*ln(2*_pi)-ln(`gx'*`sigma')+ln(normprob(-($ML_y1-`fx')*`lambda'/(`gx'*`sigma')))-0.5*(($ML_y1-`fx')/(`gx'*`sigma'))^2  



local indep "lx1 lx2 lx3 lx4 t lx11 lx12 lx13 lx14 tlx1 lx22 lx23 lx24 tlx2 lx33 lx34 tlx3 lx44 tlx4 tt hold th lx1h lx2h lx3h lx4h"


ml model d0 ml_distribution (lq: lq =`indep') (gx: lq = d01 d07 lx1 lx2 lx3 lx4 hold) (hx: lq = lx1 lx2 lx3 lx4 hold, noconstant) (sigma_u:)


ml search


ml max


I know that it should work but my command must be wrong so that Stata cannot calculate it.


Could you please help me with this. I am completely lost!


Thank you very much in advance!




© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index