Hi,
I'm working with experimental data where subjects need to be put into pairs. I am struggling to come up with a way to (i) assign the pairs and (ii) give each pair a unique number.
My data includes 58 females and 58 males.
There are 3 treatment groups that subjects can be sorted into. So the variable treatment should equal 1, 2, or 3.
29 females need to randomly be assigned to treatment 3, and 29 males need to randomly be assigned to treatment 3. I've already done this. Assigning subjects to treatment 1 and treatment 2 is a bit more complex.
I have a dummy variable called removedecision that determines how subjects in treatment 3 should be paired with the remaining 58 subjects.
This is where I need help. Is there a code I can write to do this?
Once that is done, I need to give a unique pair number to each male/female pair. I want to create a variable called pairnumberthat starts at 1 and ends at 58 and helps me identify each of the pairs I've created.
Any help with this would be much appreciated. Thanks!
I'm working with experimental data where subjects need to be put into pairs. I am struggling to come up with a way to (i) assign the pairs and (ii) give each pair a unique number.
My data includes 58 females and 58 males.
There are 3 treatment groups that subjects can be sorted into. So the variable treatment should equal 1, 2, or 3.
29 females need to randomly be assigned to treatment 3, and 29 males need to randomly be assigned to treatment 3. I've already done this. Assigning subjects to treatment 1 and treatment 2 is a bit more complex.
I have a dummy variable called removedecision that determines how subjects in treatment 3 should be paired with the remaining 58 subjects.
- If removedecision==0 for a male (female) subject in treatment 3, then they need to be paired with a random female (male) subject in treatment 1.
- If removedecision==1 for a male (female) subject in treatment 3, then they need to be paired with a random female (male) subject in treatment 2.
This is where I need help. Is there a code I can write to do this?
Once that is done, I need to give a unique pair number to each male/female pair. I want to create a variable called pairnumberthat starts at 1 and ends at 58 and helps me identify each of the pairs I've created.
Any help with this would be much appreciated. Thanks!
Comment