Announcement

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

  • permute with strata and clustering option

    Hi,
    I would like to know if someone can help me with the following problem...

    I have data from an RCT, where the randomization was clustered and stratified... meaning I have 10 districts, within each district 20% of villages were randomly allocated as treatment, and then everyone within the village was treated. This means I stratified by district (within each district 20% of villages were treated), and clustered by village (i.e., either the entire village was treated or not). I want to use a permutation test to do randomization inference, but it seems like "permute" cannot handle this type of situation.

    I'm not very good when it comes to STATA programming so I was thinking of doing this in R but I want to avoid using multiple programs if possible.

    Thank you

    Mauricio Romero


  • #2
    I have a suggestion that might put you in the right direction, but I hope that others will comment on the correctness of my thinking. I start from the perspective that, from the point of view of a randomization test, your data constitutes a sample of villages, not a sample of persons. On that basis, you would reshape your data to a sample of villages, and calculate a village-level outcome (e.g., a mean). Then, -permute- could permute the village-level treatment within your strata (districts). One wrinkle here is that presumably you would want to weight the data for villages, to reflect their different sizes, or internal variability. I'm guessing that whatever R program you are using does something like this. Here's an illustration:
    Code:
    // Create example data  
    clear
    set seed 486654
    set obs 10
    gen byte district = _n
    gen int nvillage = 10 + ceil(5 * runiform())
    expand nvillage
    bysort district: gen int village = _n
    bysort district: gen byte treat = (_n <= 0.20 * _N)
    gen int nperson = 10 + ceil(10 * runiform())
    expand nperson
    bysort district village: gen int person = _n
    tab2 treat district, col  // show the structure of the district/treatment data
    gen outcome =  3 + 0.5 * treat + rnormal(0, 5.0)  /
    //
    // Your situation would start here.
    // Reshape so that villages are the observations
    reshape wide outcome, i(district village) j(person)
    // Create a village level outcome to reflect the unit of randomization.
    egen village_outcome = rowmean(outcome*)
    //
    // Create a weight for each village.   I crudely choose the N  of persons for each
    // village.  You might choose something else.
    gen myweight = nperson
    //
    // -permute-  will not accept weights, but we can feed it a wrapper
    // program that incorporates a weight.
    cap prog drop wrapper
    prog wrapper, rclass
    args w
    regress village_outcome treat [aweight = `w']
    return scalar btreat = _b[treat]
    end
    //
    regress village_outcome treat [aweight = myweight] // asymptotic result
    permute treat r(btreat), nodots reps(1000) strata(district): wrapper myweight
    Regards, Mike
    Last edited by Mike Lacy; 11 Oct 2015, 10:24.

    Comment


    • #3
      Hi,

      not so sure that Mike's solution is equivalent to what you are looking for if you have other controls you would include e.g. to reduce noise.

      Have you come across a good way of doing this?

      Comment

      Working...
      X