Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lincom with cluster-robust errors and boottest

    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:
    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
    Anybody familiar with lincom combined with cluster-robust errors and bootstrapped errors?

    Thanks in advance!
    Arjan

  • #2
    lincom looks for the current stored estimate, which normally will have been created with the most recent estimation command. In particular, it looks at e(b) for the point estimates and e(V) for the covariance estimate. Do "matlist e(b)" and "matlist e(V)" to look at them. If your ivreghdfe command is clustered, that will be reflected in e(V), and lincom will use it.
    boottest does not compute standard errors and it posts results in r() rather than e(). lincom ignores those.

    Comment


    • #3
      To confirm what David has helpfully pointed out, you can look at the help (specifically Methods and Formulas) for -test-, which is closely related to -lincom-. You will notice the use of the variance-covariance matrix, V, being used in those linear combination for the Wald test statistic calculations. The following toy example confirms this:

      Code:
      sysuse auto, clear
      set seed 17
      reg price mpg, vce(boot)
      lincom mpg // not necessary in this example as I am regurgitating the coefficient estimate
      reg price mpg
      lincom mpg

      Comment


      • #4
        But boottest can test general linear hypotheses. Why not do
        Code:
        boottest $indepvar_endog + $indepvar_endog_lag1 + $indepvar_endog_lag2 = 0

        Comment


        • #5
          Many thanks Leonardo Guizzetti and David Roodman . For my case, David's comment #4 applies and works out.

          Comment

          Working...
          X