U.S.–China Tensions & Earnings Management
Hướng dẫn sinh viên chạy dữ liệu. Làm lần lượt; không tự đổi dataset, sample hoặc mô hình.
0Chuẩn bị dữ liệuPackages → panel → emerging sample → controls → AEM/REM → winsorization
- Đổi đường dẫn
usevàcdtheo máy. - Chạy toàn bộ block này trước Table 1.
- Không bỏ panel/sample filters/EM estimation/winsorization.
clear all
set more off
set maxvar 30000
*============================================================*
* uct - earnings management
* master do-file
*============================================================*
use "C:\Users\T14s\OneDrive\07_NGHIÊN CỨU\07_PROJECTS\UCT vs EM\02_DATA\working_data.dta", clear
cd "C:\Users\T14s\OneDrive\07_NGHIÊN CỨU\07_PROJECTS\UCT vs EM\04_RESULT"
rename *, lower
*============================================================*
* install packages
*============================================================*
capture which reghdfe
if _rc ssc install reghdfe, replace
capture which asreg
if _rc ssc install asreg, replace
capture which winsor2
if _rc ssc install winsor2, replace
capture which rangestat
if _rc ssc install rangestat, replace
capture which asdoc
if _rc ssc install asdoc, replace
*============================================================*
* panel
*============================================================*
capture drop gvkey_id gind_id fic_id
egen gvkey_id = group(gvkey)
egen gind_id = group(gind)
egen fic_id = group(fic)
duplicates drop gvkey_id fyear, force
sort gvkey_id fyear
xtset gvkey_id fyear
*============================================================*
* emerging market sample
*============================================================*
capture drop emerging
gen emerging = strpos(" arg bhr bgd bra bgr chl chn col cze egy hun ind idn mys mex pak per phl pol qat rou rus sau zaf tha tur are vnm "," "+lower(trim(fic))+" ") > 0
tab emerging
tab fic if emerging==1
keep if emerging==1
drop if inlist(substr(gind,1,2),"40","55")
drop if missing(at)
drop if at<=0
drop if missing(sale)
drop if sale<0
*============================================================*
* minimum number of firms by country
*============================================================*
egen tag_country = tag(fic gvkey_id)
bysort fic: egen n_country = total(tag_country)
drop if n_country<20
drop tag_country n_country
*============================================================*
* minimum number of firms by industry
*============================================================*
egen tag_industry = tag(gind gvkey_id)
bysort gind: egen n_industry = total(tag_industry)
drop if n_industry<20
drop tag_industry n_industry
sort gvkey_id fyear
xtset gvkey_id fyear
*============================================================*
* firm controls
*============================================================*
capture drop siz
gen siz = ln(at)
capture drop lev
gen lev = (dltt+dlc)/at
capture drop marketvalue
gen marketvalue = prcc*cshoc/1000000
capture drop mb
gen mb = (at+marketvalue-ceq)/at
capture drop roa
gen roa = ib/at
capture drop sg
gen sg = (sale-l.sale)/l.sale
capture drop ppe_at
gen ppe_at = ppent/l.at
capture drop cfo_at
gen cfo_at = oancf/l.at
*============================================================*
* firm age
*============================================================*
capture drop age
bysort gvkey_id (fyear): gen age = fyear-fyear[1]+1
capture drop l_age
gen l_age = ln(age)
*============================================================*
* sales volatility
*============================================================*
capture drop sg1 sg2 sg3 sg4 sg5 vol
gen sg1 = l.sg
gen sg2 = l2.sg
gen sg3 = l3.sg
gen sg4 = l4.sg
gen sg5 = l5.sg
egen vol = rowsd(sg1 sg2 sg3 sg4 sg5)
*============================================================*
* free cash flow
*============================================================*
capture drop fcf_ta
gen fcf_ta = (ebitda-xint-txt-dvt-capx)/at
*============================================================*
* whited-wu financial constraints
*============================================================*
capture drop cf div_dum ltdebt ind_sale_mean isg ww
gen cf = (nicon+dp)/at
gen div_dum = 0
replace div_dum = 1 if dvt>0 & !missing(dvt)
gen ltdebt = dltt/at
bysort gind fyear: egen ind_sale_mean = mean(sg)
sort gvkey_id fyear
xtset gvkey_id fyear
gen isg = (ind_sale_mean-l.ind_sale_mean)/l.ind_sale_mean
gen ww = -0.091*cf-0.062*div_dum+0.021*ltdebt-0.044*siz+0.102*isg-0.035*sg
*============================================================*
* basic variables for accrual earnings management
*============================================================*
capture drop l_at inv_at ta ch_rev_at ch_rec_at rev_rec roa_match
gen l_at = l.at
gen inv_at = 1/l_at
gen ta = (ib-oancf)/l_at
gen ch_rev_at = (sale-l.sale)/l_at
gen ch_rec_at = (rect-l.rect)/l_at
gen rev_rec = ch_rev_at-ch_rec_at
gen roa_match = ib/l_at
*============================================================*
* pda1 - performance matched jones model
*============================================================*
capture drop nda1 em1 roa_prev roa_next em1_prev em1_next distance_prev distance_next matched_em1 pmda1 pda1
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
capture drop _*
asreg ta inv_at ch_rev_at ppe_at, by(gind fyear) fit min(10)
gen nda1 = _fitted
gen em1 = ta-nda1
sort gind fyear roa_match gvkey_id
by gind fyear: gen roa_prev = roa_match[_n-1] if _n>1
by gind fyear: gen roa_next = roa_match[_n+1] if _n<_N
by gind fyear: gen em1_prev = em1[_n-1] if _n>1
by gind fyear: gen em1_next = em1[_n+1] if _n<_N
gen distance_prev = abs(roa_match-roa_prev)
gen distance_next = abs(roa_match-roa_next)
gen matched_em1 = em1_prev if distance_prev<=distance_next & !missing(distance_prev)
replace matched_em1 = em1_next if distance_next<distance_prev & !missing(distance_next)
replace matched_em1 = em1_next if missing(matched_em1) & !missing(em1_next)
replace matched_em1 = em1_prev if missing(matched_em1) & !missing(em1_prev)
gen pmda1 = em1-matched_em1
gen pda1 = abs(pmda1)
*============================================================*
* pda2 - performance matched modified jones
*============================================================*
capture drop nda2 em2 roa_prev2 roa_next2 em2_prev em2_next distance_prev2 distance_next2 matched_em2 pmda2 pda2
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
capture drop _*
asreg ta inv_at rev_rec ppe_at, by(gind fyear) fit min(10)
gen nda2 = _fitted
gen em2 = ta-nda2
sort gind fyear roa_match gvkey_id
by gind fyear: gen roa_prev2 = roa_match[_n-1] if _n>1
by gind fyear: gen roa_next2 = roa_match[_n+1] if _n<_N
by gind fyear: gen em2_prev = em2[_n-1] if _n>1
by gind fyear: gen em2_next = em2[_n+1] if _n<_N
gen distance_prev2 = abs(roa_match-roa_prev2)
gen distance_next2 = abs(roa_match-roa_next2)
gen matched_em2 = em2_prev if distance_prev2<=distance_next2 & !missing(distance_prev2)
replace matched_em2 = em2_next if distance_next2<distance_prev2 & !missing(distance_next2)
replace matched_em2 = em2_next if missing(matched_em2) & !missing(em2_next)
replace matched_em2 = em2_prev if missing(matched_em2) & !missing(em2_prev)
gen pmda2 = em2-matched_em2
gen pda2 = abs(pmda2)
*============================================================*
* dechow-dichev accrual estimation error
*============================================================*
capture drop wcacc cfo_dd_l cfo_dd cfo_dd_f ch_rev_dd ppe_dd em_dd absaccdd
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
sort gvkey_id fyear
xtset gvkey_id fyear
gen wcacc = ((act-l.act)-(che-l.che)-((lct-l.lct)-(dlc-l.dlc)))/l_at
gen cfo_dd_l = l.oancf/l_at
gen cfo_dd = oancf/l_at
gen cfo_dd_f = f.oancf/l_at
gen ch_rev_dd = (sale-l.sale)/l_at
gen ppe_dd = ppent/l_at
capture drop _*
asreg wcacc cfo_dd_l cfo_dd cfo_dd_f ch_rev_dd ppe_dd, by(gind fyear) fit min(10)
gen em_dd = _residual
gen absaccdd = abs(em_dd)
*============================================================*
* accrual quality
*============================================================*
capture drop aq aq_n
rangestat (sd) aq=em_dd (count) aq_n=em_dd, interval(fyear -4 0) by(gvkey_id)
replace aq=. if aq_n<3
*============================================================*
* abnormal cfo
*============================================================*
foreach v in sale_at d_sale_at cfo_hat cfo_resid abn_cfo {
capture drop `v'
}
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
gen sale_at = sale/l_at
gen d_sale_at = (sale-l.sale)/l_at
capture drop _*
asreg cfo_at inv_at sale_at d_sale_at, by(gind fyear) fit min(10)
gen cfo_hat = _fitted
gen cfo_resid = cfo_at-cfo_hat
gen abn_cfo = abs(cfo_resid)
*============================================================*
* abnormal discretionary expenses
*============================================================*
capture drop disx disx_at l_sale_at disx_hat disx_resid abn_disx
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
gen disx = xsga
replace disx = 0 if missing(disx)
gen disx_at = disx/l_at
gen l_sale_at = l.sale/l_at
capture drop _*
asreg disx_at inv_at l_sale_at, by(gind fyear) fit min(10)
gen disx_hat = _fitted
gen disx_resid = disx_at-disx_hat
gen abn_disx = abs(disx_resid)
*============================================================*
* abnormal production costs
*============================================================*
capture drop prod prod_at l_d_sale_at prod_hat prod_resid abn_prod
capture drop _b_* _se_* _fitted _residual _Nobs _R2 _adjR2
gen prod = cogs+(invt-l.invt)
gen prod_at = prod/l_at
gen l_d_sale_at = (l.sale-l2.sale)/l_at
capture drop _*
asreg prod_at inv_at sale_at d_sale_at l_d_sale_at, by(gind fyear) fit min(10)
gen prod_hat = _fitted
gen prod_resid = prod_at-prod_hat
gen abn_prod = abs(prod_resid)
*============================================================*
* aggregate real earnings management
*============================================================*
capture drop rem
egen rem = rowmean(abn_cfo abn_disx abn_prod)
*============================================================*
* globals
*============================================================*
global controls siz mb cfo_at lev sg ppe_at roa
global aem pda1 pda2 absaccdd aq
global remvars abn_cfo abn_disx abn_prod rem
global emvars pda1 pda2 absaccdd aq abn_cfo abn_disx abn_prod rem
global shocks uct tui gpr epu wui
global culture idv uai lto mas pdi ivr
global governance va ps ge rq rl corr pca_iq iq ip cr
global development gdpg gdp_pc stk_trd stk_cap dcps fd fi fm fia fid fie fma fmd fme
*============================================================*
* final sample
*============================================================*
drop if missing(uct)
foreach x of global controls {
drop if missing(`x')
}
*============================================================*
* winsorization
*============================================================*
winsor2 siz mb cfo_at lev sg ppe_at roa pda1 pda2 absaccdd aq abn_cfo abn_disx abn_prod rem fcf_ta ww, cuts(1 99) replace
*============================================================*1Table 1 Descriptive StatisticsMô tả UCT, controls và các thước đo EM.
Mô tả UCT, controls và các thước đo EM.
table1_descriptive.doc
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 1 descriptive statistics
*============================================================*
capture erase "table1_descriptive.doc"
asdoc tabstat uct $controls $emvars, stat(N mean sd min p25 p50 p75 max) columns(statistics) save(table1_descriptive.doc) replace title(Table 1. Descriptive Statistics)
*============================================================*2Table 2 CorrelationTương quan Pearson giữa UCT, controls và EM.
Tương quan Pearson giữa UCT, controls và EM.
table2_correlation.doc
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 2 correlation
*============================================================*
capture erase "table2_correlation.doc"
asdoc pwcorr uct $controls $emvars, star(all) save(table2_correlation.doc) replace title(table 2 pearson correlation matrix)
*============================================================*3Table 3 Sample Composition By CountryCơ cấu mẫu theo quốc gia.
Cơ cấu mẫu theo quốc gia.
table3_sample_country.doc
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 3 sample composition by country
*============================================================*
capture erase "table3_sample_country.doc"
preserve
bysort fic gvkey_id: gen firm_tag = (_n==1)
collapse (count) observations=gvkey_id (sum) firms=firm_tag, by(fic)
gsort -observations
asdoc list fic firms observations, noobs save(table3_sample_country.doc) replace title(table 3 sample composition by country)
restore
*============================================================*3BTable 3B Sample Composition By IndustryCơ cấu mẫu theo ngành.
Cơ cấu mẫu theo ngành.
table3b_sample_industry.doc
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 3b sample composition by industry
*============================================================*
capture erase "table3b_sample_industry.doc"
preserve
bysort gind gvkey_id: gen firm_tag = (_n==1)
collapse (count) observations=gvkey_id (sum) firms=firm_tag, by(gind)
gsort -observations
asdoc list gind firms observations, noobs save(table3b_sample_industry.doc) replace title(table 3b sample composition by industry)
restore
*============================================================*4Table 4 High Versus Low UctSo sánh mean/median giữa UCT thấp và cao.
So sánh mean/median giữa UCT thấp và cao.
table4_high_low_uct.docx
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 4 high versus low uct
*============================================================*
capture erase "table4_high_low_uct.docx"
preserve
capture drop uct_quartile high_uct
xtile uct_quartile = uct, nq(4)
keep if inlist(uct_quartile,1,4)
gen high_uct = (uct_quartile==4)
*------------------------------------------------------------*
* create results matrix
*------------------------------------------------------------*
local nvars : word count $emvars
local nrows = `nvars' * 2
matrix results = J(`nrows',5,.)
local row = 1
local rownames
foreach y of global emvars {
*---------------- mean ----------------*
quietly summarize `y' if high_uct==0
local mean_low = r(mean)
quietly summarize `y' if high_uct==1
local mean_high = r(mean)
quietly ttest `y', by(high_uct)
local p_mean = r(p)
matrix results[`row',1] = `mean_low'
matrix results[`row',2] = `mean_high'
matrix results[`row',3] = `mean_high' - `mean_low'
matrix results[`row',4] = `p_mean'
matrix results[`row',5] = 1
local rownames `rownames' `y'_mean
local ++row
*---------------- median ----------------*
quietly summarize `y' if high_uct==0, detail
local median_low = r(p50)
quietly summarize `y' if high_uct==1, detail
local median_high = r(p50)
quietly ranksum `y', by(high_uct)
local p_median = 2*normal(-abs(r(z)))
matrix results[`row',1] = `median_low'
matrix results[`row',2] = `median_high'
matrix results[`row',3] = `median_high' - `median_low'
matrix results[`row',4] = `p_median'
matrix results[`row',5] = 2
local rownames `rownames' `y'_median
local ++row
}
*============================================================*
* export professional word table
*============================================================*
putdocx clear
putdocx begin, pagesize(A4) font("Times New Roman",10)
putdocx paragraph, halign(center)
putdocx text ("Table 4. Earnings Management: High versus Low UCT"), ///
bold font("Times New Roman",12)
putdocx paragraph, halign(center)
putdocx text ("Comparison of the lowest and highest quartiles of UCT"), ///
italic font("Times New Roman",9)
putdocx paragraph
local totalrows = `nrows' + 2
putdocx table tbl = (`totalrows',6), ///
border(all, single) ///
width(100%)
*------------------------------------------------------------*
* header
*------------------------------------------------------------*
putdocx table tbl(1,1) = ("EM Measure")
putdocx table tbl(1,2) = ("Statistic")
putdocx table tbl(1,3) = ("Low UCT")
putdocx table tbl(1,4) = ("High UCT")
putdocx table tbl(1,5) = ("Difference")
putdocx table tbl(1,6) = ("p-value")
putdocx table tbl(1,.), bold halign(center) valign(center)
*------------------------------------------------------------*
* observations header
*------------------------------------------------------------*
quietly count if high_uct==0
local n_low = r(N)
quietly count if high_uct==1
local n_high = r(N)
putdocx table tbl(2,1) = ("Observations")
putdocx table tbl(2,2) = ("N")
putdocx table tbl(2,3) = ("`n_low'")
putdocx table tbl(2,4) = ("`n_high'")
putdocx table tbl(2,5) = ("")
putdocx table tbl(2,6) = ("")
putdocx table tbl(2,.), italic halign(center)
*------------------------------------------------------------*
* fill table
*------------------------------------------------------------*
local r = 3
foreach y of global emvars {
*================ mean =================*
quietly summarize `y' if high_uct==0
local low = r(mean)
quietly summarize `y' if high_uct==1
local high = r(mean)
quietly ttest `y', by(high_uct)
local p = r(p)
local diff = `high' - `low'
local stars ""
if `p' < 0.10 local stars "*"
if `p' < 0.05 local stars "**"
if `p' < 0.01 local stars "***"
local lowf : display %9.4f `low'
local highf : display %9.4f `high'
local difff : display %9.4f `diff'
if `p' < 0.001 {
local pf "<0.001"
}
else {
local pf : display %6.4f `p'
}
putdocx table tbl(`r',1) = ("`y'")
putdocx table tbl(`r',2) = ("Mean")
putdocx table tbl(`r',3) = ("`lowf'")
putdocx table tbl(`r',4) = ("`highf'")
putdocx table tbl(`r',5) = ("`difff'`stars'")
putdocx table tbl(`r',6) = ("`pf'")
putdocx table tbl(`r',3/6), halign(center)
local ++r
*================ median =================*
quietly summarize `y' if high_uct==0, detail
local low = r(p50)
quietly summarize `y' if high_uct==1, detail
local high = r(p50)
quietly ranksum `y', by(high_uct)
local p = 2*normal(-abs(r(z)))
local diff = `high' - `low'
local stars ""
if `p' < 0.10 local stars "*"
if `p' < 0.05 local stars "**"
if `p' < 0.01 local stars "***"
local lowf : display %9.4f `low'
local highf : display %9.4f `high'
local difff : display %9.4f `diff'
if `p' < 0.001 {
local pf "<0.001"
}
else {
local pf : display %6.4f `p'
}
putdocx table tbl(`r',1) = ("")
putdocx table tbl(`r',2) = ("Median")
putdocx table tbl(`r',3) = ("`lowf'")
putdocx table tbl(`r',4) = ("`highf'")
putdocx table tbl(`r',5) = ("`difff'`stars'")
putdocx table tbl(`r',6) = ("`pf'")
putdocx table tbl(`r',3/6), halign(center)
local ++r
}
*------------------------------------------------------------*
* formatting
*------------------------------------------------------------*
putdocx table tbl(.,.), font("Times New Roman",9) valign(center)
putdocx paragraph
putdocx text ("Notes: Low UCT and High UCT correspond to the first and fourth quartiles of UCT, respectively. Differences in means are tested using two-sample t-tests. Differences in medians are tested using Wilcoxon rank-sum tests. ***, **, and * denote statistical significance at the 1%, 5%, and 10% levels, respectively."), ///
font("Times New Roman",8) italic
putdocx save "table4_high_low_uct.docx", replace
restore
*============================================================*5Table 5 Baseline Uct And Earnings ManagementBaseline UCT → 8 thước đo EM.
Baseline UCT → 8 thước đo EM.
table5_baseline_uct_em.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 5 baseline uct and earnings management
*============================================================*
capture erase "table5_baseline_uct_em.rtf"
capture which esttab
if _rc ssc install estout, replace
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls, absorb(gind_id fic_id) vce(cluster gvkey_id)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table5_baseline_uct_em.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 5. UCT and Earnings Management") compress nogaps
eststo clear
*============================================================*6Table 6 Alternative Uncertainty MeasuresThay UCT bằng TUI/GPR/EPU/WUI.
Thay UCT bằng TUI/GPR/EPU/WUI.
table6_alternative_uncertainty.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 6 alternative uncertainty measures
* all results in one word file
*============================================================*
capture erase "table6_alternative_uncertainty.rtf"
local firstshock = 1
foreach shock in tui gpr epu wui {
capture confirm variable `shock'
if !_rc {
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' `shock' $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
if `firstshock'==1 {
esttab m* using "table6_alternative_uncertainty.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 6A. `shock' and Earnings Management") compress nogaps
local firstshock = 0
}
else {
esttab m* using "table6_alternative_uncertainty.rtf", append b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 6. `shock' and Earnings Management") compress nogaps
}
eststo clear
}
}
*============================================================*6BTable 6B Uct Controlling For Alternative Uncertainty MeasuresUCT + lần lượt GPR/EPU/WUI.
UCT + lần lượt GPR/EPU/WUI.
table6b_uct_alternative_controls.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 6b uct controlling for alternative uncertainty measures
* all results in one word file
*============================================================*
capture erase "table6b_uct_alternative_controls.rtf"
local firstshock = 1
foreach shock in gpr epu wui {
capture confirm variable `shock'
if !_rc {
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct `shock' $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
if `firstshock'==1 {
esttab m* using "table6b_uct_alternative_controls.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 6B. UCT Controlling for `shock'") compress nogaps
local firstshock = 0
}
else {
esttab m* using "table6b_uct_alternative_controls.rtf", append b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 6B. UCT Controlling for `shock'") compress nogaps
}
eststo clear
}
}
*============================================================*6CTable 6C Orthogonalized UctUCT orthogonalized với các uncertainty measures.
UCT orthogonalized với các uncertainty measures.
table6c_orthogonalized_uct.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 6c orthogonalized uct
*============================================================*
capture drop uct_orth
preserve
keep fyear uct gpr epu wui
duplicates drop fyear, force
reg uct gpr wui
predict uct_orth, resid
keep fyear uct_orth
tempfile uct_residual
save `uct_residual'
restore
merge m:1 fyear using `uct_residual', nogen
capture erase "table6c_orthogonalized_uct.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct_orth $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table6c_orthogonalized_uct.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 6C. Orthogonalized UCT and Earnings Management") compress nogaps
eststo clear
*============================================================*7Table 7 Uct With Alternative Fixed EffectsSpecification fixed effects/cluster thay thế.
Specification fixed effects/cluster thay thế.
table7_uct_alternative_fe.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 7 uct with alternative fixed effects
*============================================================*
capture erase "table7_uct_alternative_fe.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table7_uct_alternative_fe.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 7. UCT and Earnings Management") compress nogaps
eststo clear
*============================================================*8Table 8 Exclude ChinaLoại China.
Loại China.
table8_exclude_china.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 8 exclude china
*============================================================*
capture erase "table8_exclude_china.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls if lower(fic)!="chn", absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table8_exclude_china.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 8. UCT and Earnings Management Excluding China") compress nogaps
eststo clear
*============================================================*9Table 9 Exclude IndiaLoại India.
Loại India.
table9_exclude_india.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 9 exclude india
*============================================================*
capture erase "table9_exclude_india.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls if lower(fic)!="ind", absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table9_exclude_india.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 9. UCT and Earnings Management Excluding India") compress nogaps
eststo clear
*============================================================*10Table 10 Exclude China And IndiaLoại China và India.
Loại China và India.
table10_exclude_china_india.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 10 exclude china and india
*============================================================*
capture erase "table10_exclude_china_india.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls if !inlist(lower(fic),"chn","ind"), absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table10_exclude_china_india.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 10. UCT and Earnings Management Excluding China and India") compress nogaps
eststo clear
*============================================================*11Table 11 Firm Fixed EffectsFirm fixed effects.
Firm fixed effects.
table11_firm_fe.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 11 firm fixed effects
*============================================================*
capture erase "table11_firm_fe.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct $controls, absorb(gvkey_id gind_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local firm_fe "Yes"
estadd local industry_fe "Yes"
local ++i
}
esttab m* using "table11_firm_fe.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(firm_fe industry_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Firm FE" "Industry FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 11. UCT and Earnings Management with Firm Fixed Effects") compress nogaps
eststo clear
*============================================================*12Table 12 Lagged UctUCT trễ một năm.
UCT trễ một năm.
table12_lagged_uct.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 12 lagged uct
*============================================================*
capture drop uct_lag
preserve
keep fyear uct
duplicates drop
sort fyear
gen uct_lag = uct[_n-1] if fyear==fyear[_n-1]+1
keep fyear uct_lag
tempfile laguct
save `laguct'
restore
merge m:1 fyear using `laguct', nogen
capture erase "table12_lagged_uct.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct_lag $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table12_lagged_uct.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 12. Lagged UCT and Earnings Management") compress nogaps
eststo clear
*============================================================*13Table 13 Change In UctThay đổi hàng năm của UCT.
Thay đổi hàng năm của UCT.
table13_change_uct.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 13 change in uct
*============================================================*
capture drop d_uct
preserve
keep fyear uct
duplicates drop
sort fyear
gen d_uct = uct-uct[_n-1] if fyear==fyear[_n-1]+1
keep fyear d_uct
tempfile duct
save `duct'
restore
merge m:1 fyear using `duct', nogen
capture erase "table13_change_uct.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' d_uct $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table13_change_uct.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 13. Changes in UCT and Earnings Management") compress nogaps
eststo clear
*============================================================*14Table 14 Institutional QualityPCA institutional quality và UCT × IQ.
PCA institutional quality và UCT × IQ.
table14_uct_institutional_quality.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 14 institutional quality
*============================================================*
capture drop iq
pca cc ge pv rl rq va
predict iq, score
label variable iq "Institutional Quality Index (PCA)"
summarize iq, detail
capture confirm variable iq
if !_rc {
capture erase "table14_uct_institutional_quality.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' c.uct##c.iq $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table14_uct_institutional_quality.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) keep(uct iq c.uct#c.iq) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 14. Institutional Quality and the UCT-Earnings Management Relation") compress nogaps
eststo clear
}
*============================================================*15Table 15 Financial DevelopmentUCT × FD/FI/FM.
UCT × FD/FI/FM.
table15_uct_financial_development.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 15 financial development
*============================================================*
capture erase "table15_uct_financial_development.rtf"
local first = 1
foreach z in fd fi fm {
capture confirm variable `z'
if !_rc {
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' c.uct##c.`z' $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
if `first'==1 {
esttab m* using "table15_uct_financial_development.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) keep(uct `z' c.uct#c.`z') stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 15. UCT and Earnings Management: Financial Development (`z')") compress nogaps
local first = 0
}
else {
esttab m* using "table15_uct_financial_development.rtf", append b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) keep(uct `z' c.uct#c.`z') stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 15. UCT and Earnings Management: Financial Development (`z')") compress nogaps
}
eststo clear
}
}
*============================================================*16Table 16 Wild Cluster Bootstrap InferenceWild cluster bootstrap cho AQ.
Wild cluster bootstrap cho AQ.
Stata Results (boottest)
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 16 wild cluster bootstrap inference
*============================================================*
capture which boottest
if _rc {
ssc install boottest, replace
}
reg aq uct $controls i.gind_id i.fic_id, vce(cluster fyear)
boottest uct, cluster(fyear) reps(9999) seed(12345)
*============================================================*17Table 17 Placebo Test Using Future UctPlacebo UCT t+1.
Placebo UCT t+1.
table17_future_uct_placebo.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 17 placebo test using future uct
*============================================================*
capture drop uct_lead
preserve
keep fyear uct
duplicates drop
sort fyear
gen uct_lead = uct[_n+1] if fyear[_n+1]==fyear+1
keep fyear uct_lead
tempfile leaduct
save `leaduct'
restore
merge m:1 fyear using `leaduct', nogen
capture erase "table17_future_uct_placebo.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct_lead $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
esttab m* using "table17_future_uct_placebo.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 17. Placebo Test Using Future UCT") compress nogaps
eststo clear
*============================================================*17BTable 17B Permutation Placebo TestPermutation placebo 1,000 lần.
Permutation placebo 1,000 lần.
table17b_permutation_placebo.png
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 17b permutation placebo test
*============================================================*
capture drop placebo_uct
tempfile masterdata yearuct placebo_results
save `masterdata', replace
preserve
keep fyear uct
duplicates drop
sort fyear
save `yearuct', replace
restore
tempname memhold
postfile `memhold' rep beta using `placebo_results', replace
set seed 12345
forvalues r = 1/1000 {
preserve
use `yearuct', clear
gen random = runiform()
sort random
gen placebo_uct = uct
keep fyear placebo_uct
tempfile placebo
save `placebo', replace
restore
merge m:1 fyear using `placebo', nogen
quietly reghdfe aq placebo_uct $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
post `memhold' (`r') (_b[placebo_uct])
capture drop placebo_uct
}
postclose `memhold'
preserve
use `placebo_results', clear
summarize beta, detail
count if abs(beta)>=abs(.0030393)
local extreme = r(N)
local placebo_p = (`extreme'+1)/(1000+1)
display "============================================================"
display "PERMUTATION PLACEBO TEST"
display "Actual UCT coefficient = 0.0030393"
display "Number of permutations = 1000"
display "Extreme placebo coefficients = `extreme'"
display "Empirical placebo p-value = " %6.4f `placebo_p'
display "============================================================"
histogram beta, xline(.0030393) title("Table 17B. Permutation Placebo Test") xtitle("Placebo coefficient") ytitle("Frequency")
graph export "table17b_permutation_placebo.png", replace
restore
use `masterdata', clear
*============================================================*17CTable 17C Placebo Test Using Future Uct T+2 And T+3Placebo UCT t+2 và t+3.
Placebo UCT t+2 và t+3.
table17c_future_uct_placebo.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 17c placebo test using future uct t+2 and t+3
*============================================================*
capture drop uct_lead2 uct_lead3
preserve
keep fyear uct
duplicates drop
sort fyear
gen uct_lead2 = uct[_n+2] if fyear[_n+2]==fyear+2
gen uct_lead3 = uct[_n+3] if fyear[_n+3]==fyear+3
keep fyear uct_lead2 uct_lead3
tempfile futureuct
save `futureuct'
restore
merge m:1 fyear using `futureuct', nogen
*============================================================*
* export table 17c
*============================================================*
capture erase "table17c_future_uct_placebo.rtf"
local first = 1
foreach shock in uct_lead2 uct_lead3 {
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' `shock' $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
local ++i
}
if `first'==1 {
esttab m* using "table17c_future_uct_placebo.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 17C. Placebo Tests Using Future UCT - Panel A: UCT t+2") compress nogaps
local first = 0
}
else {
esttab m* using "table17c_future_uct_placebo.rtf", append b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe N r2_a, fmt(%9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Panel B: UCT t+3") compress nogaps
}
eststo clear
}
*============================================================*
* correlation check
*============================================================*
preserve
keep fyear uct uct_lead uct_lead2 uct_lead3
duplicates drop
sort fyear
pwcorr uct uct_lead uct_lead2 uct_lead3, sig
restore
display "============================================================"
display "TABLE 17C COMPLETED"
display "File: table17c_future_uct_placebo.rtf"
display "============================================================"
*============================================================*18Table 18 Uct Controlling For Linear Time TrendUCT + linear time trend.
UCT + linear time trend.
table18_uct_time_trend.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 18 uct controlling for linear time trend
*============================================================*
capture drop trend
gen trend = fyear - 2005
capture erase "table18_uct_time_trend.rtf"
eststo clear
local i = 1
foreach y of global emvars {
quietly reghdfe `y' uct trend $controls, absorb(gind_id fic_id) vce(cluster gvkey_id fyear)
eststo m`i'
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
estadd local time_trend "Yes"
local ++i
}
esttab m* using "table18_uct_time_trend.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) stats(industry_fe country_fe time_trend N r2_a, fmt(%9s %9s %9s %9.0fc %9.4f) labels("Industry FE" "Country FE" "Linear Time Trend" "Observations" "Adjusted R-squared")) mtitles($emvars) title("Table 18. UCT and Earnings Management Controlling for Linear Time Trend") compress nogaps
eststo clear
*============================================================*19Table 19 Iv Regression - Lagged Uct As Instrument2SLS dùng lagged UCT làm instrument.
2SLS dùng lagged UCT làm instrument.
table19_iv_lagged_uct.rtf
Cách chạy: chạy phần Chuẩn bị dữ liệu trước, sau đó chạy nguyên block dưới đây. Không tự đổi sample, controls, FE hoặc clustering.
* table 19 iv regression - lagged uct as instrument
*============================================================*
capture erase "table19_iv_lagged_uct.rtf"
eststo clear
ivregress 2sls aq $controls i.gind_id i.fic_id (uct = uct_lag), vce(cluster fyear)
eststo iv1
estat firststage
matrix fs = r(singleresults)
scalar firststage_f = fs[1,4]
estat endogenous
scalar endog_p = r(p_regF)
est restore iv1
estadd scalar firststage_f = firststage_f
estadd scalar endog_p = endog_p
estadd local instrument "Lagged UCT"
estadd local industry_fe "Yes"
estadd local country_fe "Yes"
estadd local year_cluster "Yes"
esttab iv1 using "table19_iv_lagged_uct.rtf", replace b(4) se(4) star(* 0.10 ** 0.05 *** 0.01) keep(uct $controls) stats(instrument firststage_f endog_p industry_fe country_fe year_cluster N r2_a, fmt(%9s %9.2f %9.4f %9s %9s %9s %9.0fc %9.4f) labels("Instrument" "First-stage F-statistic" "Endogeneity test p-value" "Industry FE" "Country FE" "Year Cluster" "Observations" "Adjusted R-squared")) title("Table 19. IV Regression: Lagged UCT as an Instrument for UCT") compress nogaps
eststo clear
*============================================================*