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'
endCode:
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)
}Cheers,
Emmanuel Murray Leclair
0 Response to Non-linear least squares regressions by group with common constant across groups
Post a Comment