I have data on the volume of transactions in markets and the market category.
I wish to divide the markets into 2 groups randomly - Control and Test. However, it is important that:
1. Each category will be roughly equally represented in the control and test groups.
2. The number of transactions in the control and test groups will be roughly the same.
Ideally, the random process would produce something like this:
How do I make this random assignment with the restrictions stated?
Code:
input market_id market_volume str20 market_category 1 100 "Big" 2 100 "Big" 3 50 "Medium" 4 50 "Medium" 5 10 "Small" 6 10 "Small" end
I wish to divide the markets into 2 groups randomly - Control and Test. However, it is important that:
1. Each category will be roughly equally represented in the control and test groups.
2. The number of transactions in the control and test groups will be roughly the same.
Ideally, the random process would produce something like this:
Code:
input market_id market_volume str20 market_category random_assignment 1 100 "Big" 1 2 100 "Big" 0 3 50 "Medium" 1 4 50 "Medium" 0 5 10 "Small" 1 6 10 "Small" 0 end
How do I make this random assignment with the restrictions stated?
Comment