I have been measuring the TFP by ACF method and for that, I have taken
Jagadeesh Shivadashan, Asssociate Professor, University of Michigan,
For your convenient I am giving the log files here, and attaching the final output coefficients that have I found from these codes. I would really appreciate if someone comes up with the solutions.
The Jagadeesh Shivadashan's (with all the respect to him) code is following while I just customized accordingly.
Here, lnva is log value added, lnb is log (blue collar employment), lnw is log(white collar employment) and lnm is log(real material cost)
Code:
////** This code generates 100 block-boostrapped samples of the data, and then calls ///the acf_solution.do program to generate corresponding ACF production function coefficient ///estimates. The directory/data file names need to be modified as necessary ***/ use "VA_L_11_12_K_1.dta", clear /** This counter sets the number of bootstrap iterations you want to have*/ global nrep 100 matrix A =J($nrep,4,99) ***************************** ///** Here we start the code to allow us to bootstrap the sample **/ sort panelid lyear //egen gid=group(panelid) //qui su gid scalar tt=r(max) //sort gid year by panelid: gen count=_N by panelid: gen smalln=_n sort panelid smalln save tempk_me, replace local i=1 while `i' < $nrep + 1 { use tempk_me, clear ///** Here we draw random samples with replacement. We sample each //// set of plant level observations as an independent block.**/ /**quietly { keep if gid[_n]~=gid[_n-1] sort gid keep gid count save temp1_me, replace set seed `i' gen kk=int(tt*uniform()+1) keep kk gen test=99 rename kk gid sort gid merge n:1 gid using temp1_me drop _merge keep if test~=. drop test egen fill=fill(1 2/3) expand count sort fill gid by fill: gen smalln=_n sort gid smalln merge n:1 gid smalln using tempk_me drop _merge drop if fill==. ren panelid oldpanelid ren fill panelid save temp2_me, replace }**/ ********************************* disp "Bootstrap replication `i'" do for_ACF.do matrix A[`i',1]=`i' matrix A[`i',2]=vcoef[1,1] matrix A[`i',3]=vcoef[1,2] matrix A[`i',4]=vcoef[1,3] local i=`i'+1 } matrix coln A = iter_num bcoef wcoef kcoef svmat A, name(col) keep iter_num *coef keep if iter_num~=. foreach xx in b w k { qui su `xx'coef, d scalar `xx'mean=r(mean) scalar `xx'99=r(p99) scalar `xx'1=r(p1) } display "bmean" bmean " b99" b99 " b1" b1 " wmean" wmean " w99" w99 " w1" w1 " kmean" kmean " k99" k99 " k1" k1 /** The 1% and 99% gives the bootstrap confidence interval ***/
and the "do for_ACF.do" The codes are:
Code:
/** This program generates estimates using one version of the ACF moment conditions **/ set more off /** Ackerberg-Caves-Frazer first stage estimation equation: getting to phihat**/ /* Generating 2nd order proxy polynomial */ local i=1 foreach x in lnb lnw lnk lnm { gen double var_`i'=`x' local i=`i'+1 } forv i=1/4{ forv j=`i'/4{ gen double var_`i'`j'=var_`i'*var_`j' } } /** In ACF, no coefficients are identified in the first stage. phihat is simply the predicted y*/ qui regress lnva var* qui predict phihat xtset panelid lyear /** Once we have this phihat, we need to enter a search routine to find the best estimates for the capital and labor coefficients. The objective function we want to maximize is defined below -- the moment conditions assume current values of capital and labor are orthogonal to unpredicted parts of the productiviy term, based on the asumption that all of labor and capital are chosen in period t-1 ***/ capture program drop ofn program define ofn tempvar e omega omlag omlag2 omlag3 epsilon mom1 mom2 mom3 xx matrix score `e'=`1' qui gen double `omega'=phihat -`e' sort panelid lyear qui gen double `omlag'=L.`omega' qui gen double `omlag2'=`omlag'^2 qui gen double `omlag3'=`omlag'^3 qui reg `omega' `omlag' `omlag2' `omlag3' qui predict `xx' qui gen `epsilon'=`omega' -`xx' qui gen double `mom1'= (`epsilon'*lnk) qui su `mom1' scalar sumom1= (r(sum))^2 qui gen double `mom2'= (`epsilon'*lnb) qui su `mom2' scalar sumom2= (r(sum))^2 qui gen double `mom3'= (`epsilon'*lnw) qui su `mom3' scalar sumom3= (r(sum))^2 scalar obj= -(sumom1 + sumom2 +sumom3) scalar `2'=obj end /** Using the amoeba optimization routine ***/ *********************************************************** qui reg lnva lnb lnw lnk mat initols=e(b) amoeba ofn initols obj vcoef . 200 0.0000001
Comment