Announcement

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

  • Calculating Wildbootstrap P-Value with jwdid

    Hello, I am trying to calculate the Wildbootstrap P-Value after I perform an analysis with jwdid.

    I am running: jwdid taxa_homicidios_total_por_100m_1 [aw= population_2000_muni], ivar(municipality_code) tvar(year) gvar(treatment_year) never cluster(state_code)

    estat group

    and then when I ran: boottest _b[group], weighttype(webb) cluster(state_code) reps(9999) seed(123) this appears: "Overriding estimator's cluster/robust settings with cluster(state_code)
    note: constraint _b[group] caused error r(111)"

    If I put the parameter boottype(wild) there is also an error

    Can someone help me please?
    Last edited by Fredie Didier; 28 Jan 2025, 03:17.

  • #2
    I believe boottest works based on the influence functions.
    estat group after jwdid however does not estimate any influence functions. So I don’t think that will work.

    Comment


    • #3
      Thanks for replying! Do you think that if I do the following below it will be correct?:

      drop if municipality_code == 2300000 | municipality_code == 2600000
      drop if population_2000_muni == .
      gen log_population = log(population_muni)

      * Create treatment variables
      gen treated = 0
      replace treated = 1 if state == "PE" & year >= 2007
      replace treated = 1 if state == "BA" & year >= 2011
      replace treated = 1 if state == "PB" & year >= 2011
      replace treated = 1 if state == "CE" & year >= 2015
      replace treated = 1 if state == "MA" & year >= 2016

      * Create treatment year (staggered treatment)
      gen treatment_year = 0
      replace treatment_year = 2011 if state == "BA" | state == "PB"
      replace treatment_year = 2015 if state == "CE"
      replace treatment_year = 2016 if state == "MA"
      replace treatment_year = 2007 if state == "PE"


      // 1. Original JWDID estimation
      jwdid taxa_homicidios_total_por_100m_1 [aw= population_2000_muni], ///
      ivar(municipality_code) tvar(year) gvar(treatment_year) never cluster(state_code)

      // 2. Get group effects and store them
      estat group, esave(group_effects)

      // 3. Create a new dataset for bootstrap testing
      clear all

      // Create matrix with the group effects
      matrix G = (2007, -20.34896 \ ///
      2011, -5.983892 \ ///
      2015, -3.803404 \ ///
      2016, -4.865206)

      // Convert matrix to dataset properly
      set obs 4
      generate treatment_year = .
      generate effect = .

      forvalues i = 1/4 {
      replace treatment_year = G[`i',1] in `i'
      replace effect = G[`i',2] in `i'
      }

      // Generate group indicators
      gen g2007 = (treatment_year == 2007)
      gen g2011 = (treatment_year == 2011)
      gen g2015 = (treatment_year == 2015)
      gen g2016 = (treatment_year == 2016)

      // Bootstrap tests for each group
      // 2007 group
      regress effect g2007
      boottest g2007, weighttype(webb) reps(9999) boottype(wild) seed(1234)

      // 2011 group
      regress effect g2011
      boottest g2011, weighttype(webb) reps(9999) boottype(wild) seed(1234)

      // 2015 group
      regress effect g2015
      boottest g2015, weighttype(webb) reps(9999) boottype(wild) seed(1234)

      // 2016 group
      regress effect g2016
      boottest g2016, weighttype(webb) reps(9999) boottype(wild) seed(1234)

      // Joint test of all groups
      regress effect g2007 g2011 g2015 g2016
      boottest {g2007} {g2011} {g2015} {g2016}, ///
      weighttype(webb) reps(999) seed(1234) madjust(sidak)

      Comment


      • #4
        I dont think it will, because now the regression is not carrying over the "noise" of the estimation.
        At the same time, i have no idea what would be a good way to simulate jwdid so that boottest works.

        Comment


        • #5
          I see. Thanks for replying. I also don't have an idea on how to use boottest with jwdid
          Last edited by Fredie Didier; 28 Jan 2025, 06:39.

          Comment

          Working...
          X