Announcement

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

  • Stratified Sampling into Equal Groups using Proportional Allocation with Odd and Even Observations in Stratum

    Hello, I have a dataset with 60 clusters that can be divided into 14 stratum. I would like to randomly allocate these 60 clusters into 2 groups - 30 intervention and 30 control. I would like to ensure balance between the two groups across 14 geographic sectors- hence, why I am choosing to do stratified sampling.

    However, the number of clusters in each strata varies, with 8 out of the 14 stratum having an odd number of clusters. I would like to do proportional allocation, where the clusters within each strata have a 50% chance of being allocated to the two groups, but also maintain an equal number in the 2 groups - 30 clusters in each.

    I have tried the following:

    sample 50, by(sector)

    This samples 34 clusters because there are 8 stratum that have an odd number of clusters. The sample to be chosen is being rounded up, giving me 4 extra clusters in my desired sample of 30.

    The only solution I can think of is randomly selecting 4 of the 8 stratum with odd observations and having those stratum round up the selected clusters and the remaining stratum round down. This would give me my desired sample size of 30 in each group, but would require some manual calculations.

    Is there a code that could make this simpler?

    Thank you for your support - I'm a first time Statalist user.

  • #2
    Welcome to the Stata Forum / Statalist,

    I wonder whether this thread may be helpful to you.
    Best regards,

    Marcos

    Comment


    • #3
      Thank you, Marcos. I have seen this thread and looked into gsample. However, it does not seem to solve my problem of sorting into equal groups when the observations within a strata are an odd number. I can't seem to find a solution for specifying the number to be sampled, while still doing proportional allocation.

      Comment


      • #4
        I think I have found the solution.

        There is great user-created command randtreat

        Here is a link to the paper and code for those running into this issue.

        https://acarril.github.io/posts/randtreat-published

        Comment

        Working...
        X