Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <hahlbrock@iamo.de>
To   statalist@hsphsun2.harvard.edu
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

Y=f(x)+g(x)v-q(x)u

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)

 

sigma=(1+h(x)^2*sigma_u^2)^0.5

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  

end

 

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!

Konstantin

 

 



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index