**************************** * stochastic frontier model* **************************** log using frontier.log, replace set more off insheet using frontier.txt, clear gen q=log(valueadd) gen k=log(capital) gen l=log(labor) * linear OLS regression: reg q k l * run the : * first stochastic frontier regression: the half normal stochastic frontier model frontier q k l, distribution(hnormal) nolog * to predict the technical inefficiency predict n_ineff, u * second stochastic frontier regression: the exponential frontier model frontier q k l, distribution(exponential) nolog * to predict the technical inefficiency predict e_ineff, u * Print them all list state q n_ineff e_ineff * user-defined MLE procedure for half-normal frontier model capture program drop frontier_halfnormal program define frontier_halfnormal version 8.0 args lnf theta1 theta2 theta3 quietly replace `lnf'=-log(`theta2')+log(norm(-($ML_y1-`theta1')*`theta3'/`theta2'))-0.5*($ML_y1-`theta1')^2/(`theta2'^2) end ml model lf frontier_halfnormal (q= k l) () () ml maximize, nolog * we got the same result as those given by the canned routine ** Panel frontier webuse frontier2, clear xi: frontier lncost lnp_k lnp_l lnout, distribution(tnormal) cm(i.quality) cost nolog