Good Morning Everyone,
I am attempting to find a way in Stata to randomly assign integer weights to a dataset from a series of decimal weights so that the number of people we are weighing up to remains the same.
For example:
We have a group of five people who have each been assigned a weight of 4.2.
Person # | Weight
Person 1 | 4.2
Person 2 | 4.2
Person 3 | 4.2
Person 4 | 4.2
Person 5 | 4.2
Weighted Total = 21 people
I am attempting to find a way to instead assign four of those people with a 4 and the fifth with a 5, and randomly select the person that is assigned the 5 from the group of five people. This way, we are still multiplying up to 21 people, instead of rounding all weights to the nearest integer where we would only be able to weight up to 20.
Rounded to nearest integer:
Person # | Weight
Person 1 | 4
Person 2 | 4
Person 3 | 4
Person 4 | 4
Person 5 | 4
Weighted Total = 20 people
Ideal scenario:
Person # | Weight
Person 1 | 4
Person 2 | 4
Person 3 | 5
Person 4 | 4
Person 5 | 4
Weighted Total = 21 people
Any help would be much appreciated. Please let me know if I can clarify my endeavor further.
Thanks a lot!
I am attempting to find a way in Stata to randomly assign integer weights to a dataset from a series of decimal weights so that the number of people we are weighing up to remains the same.
For example:
We have a group of five people who have each been assigned a weight of 4.2.
Person # | Weight
Person 1 | 4.2
Person 2 | 4.2
Person 3 | 4.2
Person 4 | 4.2
Person 5 | 4.2
Weighted Total = 21 people
I am attempting to find a way to instead assign four of those people with a 4 and the fifth with a 5, and randomly select the person that is assigned the 5 from the group of five people. This way, we are still multiplying up to 21 people, instead of rounding all weights to the nearest integer where we would only be able to weight up to 20.
Rounded to nearest integer:
Person # | Weight
Person 1 | 4
Person 2 | 4
Person 3 | 4
Person 4 | 4
Person 5 | 4
Weighted Total = 20 people
Ideal scenario:
Person # | Weight
Person 1 | 4
Person 2 | 4
Person 3 | 5
Person 4 | 4
Person 5 | 4
Weighted Total = 21 people
Any help would be much appreciated. Please let me know if I can clarify my endeavor further.
Thanks a lot!
Comment