# Estimating a stochastic production function with MLE

I am new to MLE programming and have never done it on Stata before. I am estimating a stochastic production function following Just-Pope (1978).

The formula is the following:

I understand in theory that Stata will maximize the log likelihood function through an iterative method, using the FGLS estimates of the parameters to start. I am, however unable to translate this into code. Previously, I estimated this production function using FGLS, and coded it using loops, but now I'm not sure how I can do this and if I can include fixed effects for instance.

I tried something of the form:

program define maxlike

version 14.0

args lnf xb xdelta

quietly replace lnf' = -.5*[_N * ln(2*_pi) + (\$ML_y1 - (xbeta')^2/exp(xdelta')) + xdelta']

ml model lf normal (mean:  yield_pl*=) (var:  yield_pl*=)

end

But of course it's not working. Any pointers or references on how I can do this would be greatly appreciated. I should mention that I am working with panel data.

Thank you very much in advance!