*clear all
*macro drop _all
*set more off
set scheme gg_tableau
use "pwt_10_dload_02032021.dta", clear
* Merge with natural resources share
merge 1:1 year countrycode using "natural_resources.dta"
drop if _merge==2
keep countrycode year rgdpo emp avh cn cgdpo hc ctfp natural_res
describe
keep if countrycode=="USA" | countrycode=="HKG" | countrycode=="SGP" | countrycode=="FRA" |countrycode=="DEU" | countrycode=="GBR" |countrycode=="JPN" |countrycode=="KOR" |countrycode=="ARG" |countrycode=="MEX" | countrycode=="ZAF" |countrycode=="BRA" |countrycode=="THA" | countrycode=="CHN" | countrycode=="IDN" | countrycode=="IND"
keep if year==2007 | year==2017
sum
list countrycode year rgdpo emp avh hc, sep(16)
* Physical Capital share
local alpha=0.33
* Relevant year of study
local year_base=2017
* Adjust real GDP by natural resources (assuming one uses the same deflator for GDP and nat_res)
replace rgdpo = (1-natural_res/100)*rgdpo
* Adjust GDP at current prices by natural resources
replace cgdpo = (1-natural_res/100)*cgdpo
gen output_per_worker = ln(rgdpo/(emp*avh))
gen capital_output_ratio = ln(cn/cgdpo)*`alpha'/(1-`alpha')
gen human_capital = ln(hc)
gen tfp_resid = output_per_worker - capital_output_ratio - human_capital
list countrycode year output_per_worker capital_output_ratio human_capital tfp_resid, sep(16)
foreach i in output_per_worker capital_output_ratio human_capital tfp_resid {
* Remove logs
replace `i' = exp(`i')
* Identify the value of each variable for the US
gen output_ = `i' if countrycode == "USA"
* Compute the cross-country average in each year
bys year: egen output_norm = mean(output_)
* Compute the relative values for each variable
gen norm_`i' = `i'/output_norm
drop output_ output_norm
}
list countrycode year norm_output_per_worker norm_capital_output_ratio norm_human_capital norm_tfp_resid, sep(16)
gen overall_diff = 1/norm_output_per_worker
gen contrib_capital = 1/norm_capital_output_ratio
gen contrib_labor = 1/norm_human_capital
gen contrib_TFP = 1/norm_tfp_resid
list countrycode year overall_diff contrib_capital contrib_labor contrib_TFP, sep(16)
gen share_due_to_TFP = contrib_TFP/(contrib_TFP + (contrib_labor*contrib_capital))
list countrycode year share_due_to_TFP, sep(16)
replace share_due_to_TFP =. if countrycode=="USA"
corr share_due_to_TFP norm_output_per_worker if year==`year_base'
local corr0: display %5.2f r(rho)
reg share_due_to_TFP norm_output_per_worker if year==`year_base'
local std0: display %5.2f _b[norm_output_per_worker]/_se[norm_output_per_worker]
#tw sc share_due_to_TFP norm_output_per_worker
tw (scatter share_due_to_TFP norm_output_per_worker if year==`year_base', msize(small) mlabel(countrycode) mlabsize(vsmall) mcolor(pink) mlabcolor(black) mlabposition(6)), xscale(log) xticks(0.015 0.031 0.0625 0.125 0.25 0.5 1 2) xlabel(0.015 "1/64" 0.031 "1/32" 0.0625 "1/16" 0.125 "1/8" 0.25 "1/4" 0.5 "1/2" 1 "1" 2 "2") xtitle("Output per worker `year_base', PPP current 2017 US$ (USA=1)") ytitle("Share due to TFP") legend(off) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge)) note(Correlation = `corr0' ; t-stat = `std0', position(7) ring(0)) legend(off)
#tw sc share_due_to_TFP norm_output_per_worker
tw (scatter share_due_to_TFP norm_output_per_worker if year==`year_base', msize(small) mlabel(countrycode) mlabsize(vsmall) mcolor(pink) mlabcolor(black) mlabposition(6)), xscale(log) xticks(0.015 0.031 0.0625 0.125 0.25 0.5 1 2) xlabel(0.015 "1/64" 0.031 "1/32" 0.0625 "1/16" 0.125 "1/8" 0.25 "1/4" 0.5 "1/2" 1 "1" 2 "2") xtitle("Output per worker `year_base', PPP current 2017 US$ (USA=1)") ytitle("Share due to TFP") legend(off) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge)) note(Correlation = `corr0' ; t-stat = `std0', position(7) ring(0)) legend(off)
tw (scatter norm_tfp_resid norm_output_per_worker if year==`year_base') (lfit norm_tfp_resid norm_output_per_worker if year==`year_base'), xtitle("Output per worker `year_base', PPP current 2017 US$") ytitle("Total Factor Productivity") legend(off)
tw (scatter norm_capital_output_ratio norm_output_per_worker if year==`year_base') (lfit norm_capital_output_ratio norm_output_per_worker if year==`year_base'), xtitle("Output per worker `year_base', PPP current 2017 US$") ytitle("Capital-output ratio") legend(off)
tw (scatter norm_human_capital norm_output_per_worker if year==`year_base') (lfit norm_human_capital norm_output_per_worker if year==`year_base'), xtitle("Output per worker `year_base', PPP current 2017 US$") ytitle("Human capital") legend(off)
bys year: egen median_contrib_tfp = median(share_due_to_TFP)
list countrycode year share_due_to_TFP median_contrib_tfp
tw (scatter median_contrib_tfp year if year>=1970), xtitle("year") ytitle("Median contribution of TFP") legend(off) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge))
gen contrib_cTFP = 1/ctfp
gen share_due_to_cTFP = contrib_cTFP/overall_diff
bys year: egen median_contrib_ctfp = median(share_due_to_cTFP)
list countrycode year share_due_to_TFP median_contrib_tfp median_contrib_ctfp
tw (scatter median_contrib_tfp year if year>=1970) (scatter median_contrib_ctfp year if year>=1970)
gen share_due_to_hcap = contrib_labor/(contrib_labor+contrib_capital)*(1-share_due_to_TFP)
bys year: egen median_contrib_hcap = median(share_due_to_hcap)
list countrycode year share_due_to_hcap median_contrib_hcap contrib_labor
*corr share_due_to_hcap norm_output_per_worker if year==`year_base'
*local corr0: display %5.4f r(rho)
*reg share_due_to_hcap norm_output_per_worker if year==`year_base'
*mat V=e(V)
*local std0: display %5.4f _b[norm_output_per_worker]/_se[norm_output_per_worker]
*local year_base=2017
*tw (scatter share_due_to_hcap norm_output_per_worker if year==`year_base', msize(small) mlabel(countrycode) mlabsize(vsmall) mcolor(pink) mlabcolor(black) mlabposition(6)), xscale(log) xticks(0.015 0.031 0.0625 0.125 0.25 0.5 1 2) xlabel(0.015 "1/64" 0.031 "1/32" 0.0625 "1/16" 0.125 "1/8" 0.25 "1/4" 0.5 "1/2" 1 "1" 2 "2") xtitle("Output per worker `year_base', PPP current 2017 US$ (USA=1)") ytitle("Share due to Human Capital") legend(off) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge)) note(Correlation=`corr0' t-stat=`std0', position(7) ring(0)) legend(off)
gen share_due_to_cap = contrib_capital/(contrib_capital+contrib_labor)*(1-share_due_to_TFP)
bys year: egen median_contrib_cap=median(share_due_to_cap)
list countrycode year share_due_to_cap median_contrib_cap contrib_capital
*corr share_due_to_cap norm_output_per_worker if year==`year_base'
*local corr0: display %5.4f r(rho)
*reg share_due_to_cap norm_output_per_worker if year==`year_base'
*mat V=e(V)
*local std0: display %5.4f _b[norm_output_per_worker]/_se[norm_output_per_worker]
*tw (scatter share_due_to_cap norm_output_per_worker if year==`year_base', msize(small) mlabel(countrycode) mlabsize(vsmall) mcolor(pink) mlabcolor(black) mlabposition(6)), xscale(log) xticks(0.015 0.031 0.0625 0.125 0.25 0.5 1 2) xlabel(0.015 "1/64" 0.031 "1/32" 0.0625 "1/16" 0.125 "1/8" 0.25 "1/4" 0.5 "1/2" 1 "1" 2 "2") xtitle("Output per worker `year_base', PPP current 2017 US$ (USA=1)") ytitle("Share due to Physical Capital") legend(off) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge)) note(Correlation=`corr0' t-stat=`std0', position(7) ring(0)) legend(off)
*tw (scatter median_contrib_tfp year if year>1970) (scatter median_contrib_cap year if year>1970) (scatter median_contrib_hcap year if year>1970), xtitle("year") ytitle("Median contribution of TFP") legend(label(1 "TFP") label(2 "Physical Capital") label( 3 "Human Capital")) graphregion(margin(right) fcolor(white) lcolor(white)) plotregion(margin(medlarge))
list countrycode year median_contrib_tfp median_contrib_cap median_contrib_hcap
preserve
keep if year==2017
foreach i in output_per_worker capital_output_ratio human_capital{
replace `i'=ln(`i')
su `i',d
local var_`i'=r(Var)
}
g output_factor=human_capital+capital_output_ratio
su output_factor,d
local var_output_factor=r(Var)
cap drop success*
gen successcap=`var_capital_output_ratio'/`var_output_per_worker'
su successcap
gen successhcap=`var_human_capital'/`var_output_per_worker'
su successhcap
gen successoutput=`var_output_factor'/`var_output_per_worker'
su successoutput
restore