Hello!
There are a few community-contributed commands that help with estimating TFP, namely, - prodest - (ssc install prodest); and - opreg - (findit opreg). I have been reading the literature and attempted to estimate TFP following "Olley, G. S., and A. Pakes. 1996. The dynamics of productivity in the telecommunications equipment industry. Econometrica 64: 1263–1297.". For this, I used both mentioned commands and because it is quite important that I understand exactly how they work, I attempted to estimated it "by hand", that is, programming it myself.
My problem/concern is that - prodest - , - opreg - and my results never report the same exact values for the capital estimates. Sometimes (depends on the dataset used, tried it with two different datasets), my results are close (by close I mean coefficients only different at the second decimal) to one of the community-contributed commands, and the other time my results are a bit far off (by far off I mean estimates of 0.3 vs 0.4) from both commands, while the commands report similar results to each other.
The coefficient on labour is always very similar and not a concern.
My code is presented bellow. At the end, I estimate the coefficients for labour and capital using both community-contributed commands for comparison. Because - opreg - only allows for second order polynomials, I use that in my code and - prodest - so a comparison is possible.
I would greatly appreciate if anyone could explain where I have made a mistake/ the source of difference between the three estimates.
I understand that my question is more literature related/application related, and not a Stata question. In case here is not the appropriate place to ask such questions, I would appreciate if you pointed me in the right direction!
Best,
Hélder
There are a few community-contributed commands that help with estimating TFP, namely, - prodest - (ssc install prodest); and - opreg - (findit opreg). I have been reading the literature and attempted to estimate TFP following "Olley, G. S., and A. Pakes. 1996. The dynamics of productivity in the telecommunications equipment industry. Econometrica 64: 1263–1297.". For this, I used both mentioned commands and because it is quite important that I understand exactly how they work, I attempted to estimated it "by hand", that is, programming it myself.
My problem/concern is that - prodest - , - opreg - and my results never report the same exact values for the capital estimates. Sometimes (depends on the dataset used, tried it with two different datasets), my results are close (by close I mean coefficients only different at the second decimal) to one of the community-contributed commands, and the other time my results are a bit far off (by far off I mean estimates of 0.3 vs 0.4) from both commands, while the commands report similar results to each other.
The coefficient on labour is always very similar and not a concern.
My code is presented bellow. At the end, I estimate the coefficients for labour and capital using both community-contributed commands for comparison. Because - opreg - only allows for second order polynomials, I use that in my code and - prodest - so a comparison is possible.
I would greatly appreciate if anyone could explain where I have made a mistake/ the source of difference between the three estimates.
I understand that my question is more literature related/application related, and not a Stata question. In case here is not the appropriate place to ask such questions, I would appreciate if you pointed me in the right direction!
Best,
Hélder
Code:
clear all insheet using "https://raw.githubusercontent.com/GabrieleRovigatti/prodest/master/stata/data/prodest.csv", names clear local year year local id id local labour log_lab1 local capital log_k local invest log_investment local y log_y xtset `id' `year' su `year' loc maxDate = `r(max)' bys `id' (`year'): g exit = (_n == _N & `year' < `maxDate') local poly 2 local proxy `invest' local free `labour' local state `capital' loc polyvars `state' `proxy' loc varnum: word count `polyvars' loc n = 1 foreach x of local polyvars { qui g var_`n' = `x' loc interactionvars `interactionvars' var_`n' loc ++n } forv i=1/`varnum'{ forv j=`i'/`varnum'{ qui g var_`i'_`j' = var_`i'*var_`j' loc interactionvars `interactionvars' var_`i'_`j' if `poly' > 2{ forv z=`j'/`varnum'{ qui g var_`i'_`j'_`z' = var_`i'*var_`j'*var_`z' loc interactionvars `interactionvars' var_`i'_`j'_`z' if `poly' > 3{ forv g = `z'/`varnum'{ qui g var_`i'_`j'_`z'_`g' = var_`i'*var_`j'*var_`z'*var_`g' loc interactionvars `interactionvars' var_`i'_`j'_`z'_`g' if `poly' > 4{ forv v = `g'/`varnum'{ qui g var_`i'_`j'_`z'_`g'_`v' = var_`i'*var_`j'*var_`z'*var_`g'*var_`v' loc interactionvars `interactionvars' var_`i'_`j'_`z'_`g'_`v' if `poly' > 5{ forv s = `v'/`varnum'{ qui g var_`i'_`j'_`z'_`g'_`v'_`s' = var_`i'*var_`j'*var_`z'*var_`g'*var_`v'*var_`s' loc interactionvars `interactionvars' var_`i'_`j'_`z'_`g'_`v'_`s' } } } } } } } } } } local regvars `free' `control' `interactionvars' // First stage OP --> OLS model to estimate the Beta associated with labour reg `y' `regvars' local bl_op1 = _b[`labour'] predict y_hat gen phi_hat = y_hat - `bl_op1'*`labour' // Second stage OP --> Probit or logit to estimate probability of firm exit foreach var in `interactionvars' { g l_gen`var' = l.`var' local lagInterVars `lagInterVars' l_gen`var' } logit exit `lagInterVars' predict pr_hat if e(sample), pr gen pr_hat2 = pr_hat^2 // Third stage (with selection control) gen res = `y' - `bl_op1'*`labour' gen lag_pr_hat = l.pr_hat gen lag_`capital' = l.`capital' gen lag_res = l.res gen lag_phi_hat = l.phi_hat gen touse = res ~= . & `capital' ~= . & lag_`capital' ~= . & lag_phi_hat~=. & lag_pr_hat~=. nl (res = {b0} + {bk}*`capital' + {bh}*(lag_phi_hat - {bk}*lag_`capital') + /// {bhsq}*(lag_phi_hat - {bk}*lag_`capital')^2 + {bp}*pr_hat + /// {bpsq}*pr_hat2 + {bph}*pr_hat*(lag_phi_hat - {bk}*lag_`capital')) /// if touse == 1 local bk_op1 = _b[bk:_cons] // PRODEST and OPREG prodest log_y, free(log_lab1) state(log_k) proxy(log_investment) met(op) poly(2) reps(5) id(id) t(year) attrition opreg log_y, free(log_lab1) state(log_k) proxy(log_investment) exit(exit) vce(bootstrap,reps(5)) di "From manual estimation:" di "Labour coefficient is: `bl_op1'" di "Capital coefficient is: `bk_op1'"