Dear all,
I'm wondering how the command 'lincom' may account for cluster-robust errors, when the errors are bootstrapped using 'boottest'. David Roodman
The lincom manual is silent about bootstrapped errors, but based on what I read in related literature that used lincom, it does seem to account for ordinary CRVE clustered errors.
Below is the code of what I try to achieve:
Anybody familiar with lincom combined with cluster-robust errors and bootstrapped errors?
Thanks in advance!
Arjan
I'm wondering how the command 'lincom' may account for cluster-robust errors, when the errors are bootstrapped using 'boottest'. David Roodman
The lincom manual is silent about bootstrapped errors, but based on what I read in related literature that used lincom, it does seem to account for ordinary CRVE clustered errors.
Below is the code of what I try to achieve:
Code:
global i firm_id
global t i.year
* Results using CRVE clustering by country
ivreghdfe $deparvar $indepvars_exog $t ($indepvar_endog $indepvar_endog_lag1 $indepvar_endog_lag2 = $indepvar_instrument $indepvar_instrument_lag1 $indepvar_instrument_lag2), absorb($i) cluster(country)
* Store the results using outreg2
local dp = 4
local dp_value = 10^-`dp'
local idstat = round(`e(idstat)', `dp_value')
local idp = round(`e(idp)', `dp_value')
local widstat = round(`e(widstat)', `dp_value')
outreg2 using "$output\longterm_cumulative_effects.doc", drop($t $depvar) ctitle($depvar_CRVE_c) stat(coef tstat pval se ci N) addtext(idstat, `idstat', idp, `idp', widstat, `widstat', N_clust, `e(N_clust)', N_clust1, `e(N_clust1)', N_clust2, `e(N_clust2)') dec(4) append
* Results using CRVE clustering by country and sector
ivreghdfe $deparvar $indepvars_exog $t ($indepvar_endog $indepvar_endog_lag1 $indepvar_endog_lag2 = $indepvar_instrument $indepvar_instrument_lag1 $indepvar_instrument_lag2), absorb($i) cluster(country sector)
outreg2 using "$output\longterm_cumulative_effects.doc", drop($t $depvar) ctitle($depvar_CRVE_cs) stat(coef tstat pval se ci N) addtext(idstat, `idstat', idp, `idp', widstat, `widstat', N_clust, `e(N_clust)', N_clust1, `e(N_clust1)', N_clust2, `e(N_clust2)') dec(4) append
* Results using Wild bootstrap errors (WRE), clustering country and sector
boottest $indepvar_endog = 0, cluster(country sector) bootcluster(sector) nograph seed(999) reps(999) // bootcluster level is set to Sector, because the sample has fewer sectors than countries (32 countries and 15 sectors).
local boot_lag0_t = `r(t)'
local boot_lag0_p = `r(p)'
local boot_lag0_CI = `r(CIstr)'
boottest $indepvar_endog_lag1 = 0, cluster(country sector) bootcluster(sector) nograph seed(999) reps(999)
local boot_lag1_t = `r(t)'
local boot_lag1_p = `r(p)'
local boot_lag1_CI = `r(CIstr)'
boottest $indepvar_endog_lag2 = 0, cluster(country sector) bootcluster(sector) nograph seed(999) reps(999)
local boot_lag2_t = `r(t)'
local boot_lag2_p = `r(p)'
local boot_lag2_CI = `r(CIstr)'
* Test cumulative effect of $indepvar_endog lag0 + lag1 + lag2 on the outcome variable
lincom _b[$indepvar_endog]+_b[$indepvar_endog_lag1]+_b[$indepvar_endog_lag2]
estadd scalar b_cumulative=r(estimate)
estadd scalar se_cumulative=r(se)
estadd scalar t_cumulative=r(t)
estadd scalar p_cumulative=r(p)
estadd scalar lb_cumulative=r(lb)
estadd scalar ub_cumulative=r(ub)
eststo alllags
local cum_b = round(`r(estimate)', `dp_value')
local cum_t = round(`r(t)', `dp_value')
local cum_p = round(`r(p)', `dp_value')
local cum_se = round(`r(se)', `dp_value')
local cum_lb = round(`r(lb)', `dp_value')
local cum_ub = round(`r(ub)', `dp_value')
outreg2 using "$output\longterm_cumulative_effects.doc", drop($t $depvar) ctitle($depvar_WRE_cs_s) addtext(boot_lag0_p, `boot_lag0_p', boot_lag0_t, `boot_lag0_t', boot_lag0_CI, `boot_lag0_CI', boot_lag1_p, `boot_lag1_p', boot_lag1_t, `boot_lag1_t', boot_lag1_CI, `boot_lag1_CI', boot_lag2_p, `boot_lag2_p', boot_lag2_t, `boot_lag2_t', boot_lag2_CI, `boot_lag2_CI', cum_b, `cum_b', cum_t, `cum_t', cum_p, `cum_p', cum_se, `cum_se', cum_lb, `cum_lb', cum_ub, `cum_ub') dec(4) append
Thanks in advance!
Arjan

Comment