I've been piecemealing, assuming I could figure out how to combine the two sections.
Basically, there are two levels of randomization. Your comments on the other thread helped me with one level, and now I'm trying to work on the other piece.
Might be easier to explain the whole of what I'm trying to do:
I want to administer a survey to people in two types of towns: low-saturation and high-saturation. In a high saturation town, 100% of the people will be offered the survey. In a low-saturation town, 60% will be offered it. This allocation should be "random". Of the people who take the survey, 30% should be assigned treatment = 0, 40% = 1, 20% = 2, 10% =3. (This distribution has changed since the last thread and I've adapted the table accordingly).
I appreciate all that you did on the other post, but ultimately I still don't exactly understand how you did it, which i guess is why I didn't realize this was a different iteration of the same code.
I understand how I could get the 60/40 split, but how could I run this through each group of observations, rather than the entire database? For example, if I have 100 people, with 20 each in Albany, Auburn, Atlanta, Boise, and Baton Rouge, how could I get that 60% within each city, rather than 60% as a whole.
Thanks,
Sarah