Hi,
I am new to stochastic frontier analysis in Stata and am facing a problem.
I am working with xtfrontier using panel data (I have state level data for 16 states from 1966 to 2011 a total of 736 data points). I want to calculate total factor productivity for which I first calculate technical efficiency, scale efficiency and technical progress. I am following the reference from Kumbhakar and Lovell's "Stochastic Frontier Analysis pages 281 - 287
The code that I use is that following
STEP 1 RUN MODEL
xtfrontier lny lnvar1 lnvar2 lnAmnl lntract lnirrg lnED lnRain lnArea lntime lntime2 lnvar2time lnAnmltime _ISTCODE_2 _ISTCODE_3 _ISTCODE_4 _ISTCODE_5 _ISTCODE_6 _ISTCODE_7 _ISTCODE_8 _ISTCODE_9 _ISTCODE_10 _ISTCODE_11 _ISTCODE_12 _ISTCODE_13 _ISTCODE_14 _ISTCODE_15 _ISTCODE_16, tvd
STEP 2 CALCULATE TECHNICAL EFFICIENCY
tempvar ek el ef er et reed eir ea rts tp u te
predict CSCE_XTCE_te, te
predict CSCE_XTCE_u, u
predict CSCE_XTCE_xb, xb
STEP 3 CALCULATE OUTPUT ELASTICITY
gen double el = _b[lnvar1]
gen double ef = _b[ lnvar2]
gen double er = _b[ lnRain]
gen double etr = _b[ lntract ]
gen double eir = _b[ lnED]
gen double ea = _b[lnArea]
generate rts = el + ef + er + etr + eir + ea
STEP 4 CALCULATE FACTOR ELASTICITY
gen lambdaL= el/rts
gen lambdaf= ef/rts
gen lambdar= er/rts
gen lambdatr= etr/rts
gen lambdair= eir/rts
gen lambdaA= ea/rts
STEP 5 CALCULATE RETURNS TO FACTOR
gen dot_l =( lnvar1- lnvar1 [_n-1])/(.5* (lnvar1+ lnvar1 [_n-1]))
gen dot_f =( lnvar2 - lnvar2 [_n-1])/(.5* ( lnvar2+ lnvar2 [_n-1]))
gen dot_tr =( lntract- lntract [_n-1])/(.5* ( lntract+ lntract[_n-1]))
gen dot_ir =( lnirrg- lnirrg [_n-1])/(.5* ( lnirrg+ lnirrg[_n-1]))
gen dot_a=( lnArea- lnArea[_n-1])/(.5* ( lnArea+ lnArea[_n-1]))
gen dot_r =( lnRain- lnRain [_n-1])/(.5* ( lnRain+ lnRain [_n-1]))
STEP 6 CALCULATE RETURNS TO SCALE
gen sum_lambda_dox = (lambdaL) * dot_l + (lambdaf) * dot_f + ( lambdar)* dot_r + ( lambdatr) * dot_tr + ( lambdair)* dot_ir+ ( lambdaA)* dot_a
STEP 7 CALCULATE SCALE EFFICIENCY
gen scale= (rts-1)* sum_lambda_dox
STEP 8 CALCULATE TECHNOLOGICAL CHANGE
gen double TC = _b[ lntime] + _b[ lntime2 ]* lntime + _b[ Anmltime]* lnAnml + _b[ raintime]* lnrain + _b[ Var2time]* lnvar2 + _b[ var1time]* lnvar1 + _b[ tracttime]* lntract + _b[ EDTime]* lnED+ _b[ IRRtime]* lnIggr
STEP 8 CALCULATE TFP
gen double tfp = TC+ scale+ CSCE_XTCE_te
My problem is that when I try to calculate Technical change (step 8) I get an error that variable Anmltime not found though the variable is there is the data file.
I have tried to rename the variable but the error comes up every time I run the command.
It seems that I am missing something while estimating the stochastic frontier and calculating the total factor productivity but I am not clear what?
Can anyone aid me in this matter please?
I am new to stochastic frontier analysis in Stata and am facing a problem.
I am working with xtfrontier using panel data (I have state level data for 16 states from 1966 to 2011 a total of 736 data points). I want to calculate total factor productivity for which I first calculate technical efficiency, scale efficiency and technical progress. I am following the reference from Kumbhakar and Lovell's "Stochastic Frontier Analysis pages 281 - 287
The code that I use is that following
STEP 1 RUN MODEL
xtfrontier lny lnvar1 lnvar2 lnAmnl lntract lnirrg lnED lnRain lnArea lntime lntime2 lnvar2time lnAnmltime _ISTCODE_2 _ISTCODE_3 _ISTCODE_4 _ISTCODE_5 _ISTCODE_6 _ISTCODE_7 _ISTCODE_8 _ISTCODE_9 _ISTCODE_10 _ISTCODE_11 _ISTCODE_12 _ISTCODE_13 _ISTCODE_14 _ISTCODE_15 _ISTCODE_16, tvd
STEP 2 CALCULATE TECHNICAL EFFICIENCY
tempvar ek el ef er et reed eir ea rts tp u te
predict CSCE_XTCE_te, te
predict CSCE_XTCE_u, u
predict CSCE_XTCE_xb, xb
STEP 3 CALCULATE OUTPUT ELASTICITY
gen double el = _b[lnvar1]
gen double ef = _b[ lnvar2]
gen double er = _b[ lnRain]
gen double etr = _b[ lntract ]
gen double eir = _b[ lnED]
gen double ea = _b[lnArea]
generate rts = el + ef + er + etr + eir + ea
STEP 4 CALCULATE FACTOR ELASTICITY
gen lambdaL= el/rts
gen lambdaf= ef/rts
gen lambdar= er/rts
gen lambdatr= etr/rts
gen lambdair= eir/rts
gen lambdaA= ea/rts
STEP 5 CALCULATE RETURNS TO FACTOR
gen dot_l =( lnvar1- lnvar1 [_n-1])/(.5* (lnvar1+ lnvar1 [_n-1]))
gen dot_f =( lnvar2 - lnvar2 [_n-1])/(.5* ( lnvar2+ lnvar2 [_n-1]))
gen dot_tr =( lntract- lntract [_n-1])/(.5* ( lntract+ lntract[_n-1]))
gen dot_ir =( lnirrg- lnirrg [_n-1])/(.5* ( lnirrg+ lnirrg[_n-1]))
gen dot_a=( lnArea- lnArea[_n-1])/(.5* ( lnArea+ lnArea[_n-1]))
gen dot_r =( lnRain- lnRain [_n-1])/(.5* ( lnRain+ lnRain [_n-1]))
STEP 6 CALCULATE RETURNS TO SCALE
gen sum_lambda_dox = (lambdaL) * dot_l + (lambdaf) * dot_f + ( lambdar)* dot_r + ( lambdatr) * dot_tr + ( lambdair)* dot_ir+ ( lambdaA)* dot_a
STEP 7 CALCULATE SCALE EFFICIENCY
gen scale= (rts-1)* sum_lambda_dox
STEP 8 CALCULATE TECHNOLOGICAL CHANGE
gen double TC = _b[ lntime] + _b[ lntime2 ]* lntime + _b[ Anmltime]* lnAnml + _b[ raintime]* lnrain + _b[ Var2time]* lnvar2 + _b[ var1time]* lnvar1 + _b[ tracttime]* lntract + _b[ EDTime]* lnED+ _b[ IRRtime]* lnIggr
STEP 8 CALCULATE TFP
gen double tfp = TC+ scale+ CSCE_XTCE_te
My problem is that when I try to calculate Technical change (step 8) I get an error that variable Anmltime not found though the variable is there is the data file.
I have tried to rename the variable but the error comes up every time I run the command.
It seems that I am missing something while estimating the stochastic frontier and calculating the total factor productivity but I am not clear what?
Can anyone aid me in this matter please?