Hello,

I am trying to perform the following production function estimation procedure. I have a panel of firms where the dependent variable is LogY and dependent variables are Lspend, Espend, KL, ML. The paramters to estimate are rho, akal, amal, sig.

Code:
program nlpfe    
    version 16
    
    syntax varlist(min=5 max=5) if, at(name)
    local LogY: word 1 of `varlist'
    local Lspend: word 2 of `varlist'
    local Espend: word 3 of `varlist'
    local KL: word 4 of `varlist'
    local ML: word 5 of `varlist'

    // Define parameters
    tempname rho akal amal sig
    scalar `rho' = `at'[1,1]
    scalar `akal' = `at'[1,2]
    scalar `amal' = `at'[1,3]
    scalar `sig' = `at'[1,4]

    // Some temporary variables (functions within CES)
    tempvar kterm mterm constant
    generate double `kterm' = `akal'*(`KL'^((`sig'-1)/`sig')) `if'
    generate double `mterm' = `amal'*(`ML'^((`sig'-1)/`sig')) `if'
    generate double `constant' = ln(`rho'/(`rho'-1)) `if'

    // Now fill in dependent variable
    replace `LogY' = `constant' + ln(`Lspend'*(1+`kterm'+`mterm') + `Espend') `if'
end
I want to do this by industry. So the estimation command looks like this, where ind is the variable that records industries:

Code:
levlesof ind, local(industry)
foreach j of local industry {
    nl pfe @ LogY Lspend Espend KL ML if ind == `j', parameters(rho akal amal sig) initial(rho 2 akal 2 amal 2 sig 2)
}
This is working well. However, it is not exactly what I want. Indeed I would like to have estimates of akal, amal and sig that vary by industry (as I have now) but an estimate of rho that is common across industries. Any tips on how that can be done?

Cheers,
Emmanuel Murray Leclair